Adding Action on Single Post Template

Community Forums Forums Design Tips and Tricks Adding Action on Single Post Template

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  juiceman 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #85526

    juiceman
    Participant
    Post count: 6

    I have done something similar to what I am trying to do in the past but want to get my templates cleaned up and make use of the hooks.

    Here is the url:
    http://wildbirddigest.com/birds/brewers-blackbird/

    I have a Custom Post Type called ssbd_birds. The template I am working on is single-ssbd_birds.php

    I have some custom metaboxes that I would like to output into the template. The one shown is ssbd_summerview.
    It worked on my old templates but I cannot get it to show in my new action.

    1. How do I call for my custom metaboxes?

    2. I would also like to be able to call for the featured image in the same fashion?

    <?php
    // Template Name: Single Bird Posts
    
    // remove_action( 'genesis_entry_header', 'streamline_post_image', 1 );
    
    remove_action( 'genesis_entry_header', 'genesis_post_info', 2 );
    
    add_action('genesis_entry_content', 'ssbd_show_views', 1);
    function ssbd_show_views() { ?>
    
    	<p><img src="<?php $key="ssbd_summerview"; echo get_post_meta($post->ID, $key, true); ?>" /></p>
    
    	<p>I can get this paragraph to show, but not the image above.</p>
     
    <?php }
    
    genesis();

    Any help is greatly appreciated!

    Thanks

    http://wildbirddigest.com/birds/brewers-blackbird/
    #85667

    juiceman
    Participant
    Post count: 6

    I have figured out how to get the values of the custom meta boxes in. But only text ones. I have two meta boxes that are file uploads and am unable to get the images to diaplay.

    Is there something wrong with the code I’m using?

    Also, I cant get the post content to start AFTER/UNDER the two column top section. Is something not clearing correctly? I’ve tried to clear: both in may ways but can’t seem to make it work.

    Any suggestions are greatly appreciated! Thanks!

    <?php
    // Template Name: Single Bird Posts
    
    remove_action( 'genesis_entry_header', 'streamline_post_image', 1 );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 2 );
    
    add_action('genesis_entry_content', 'ssbd_show_views', 1);
    	function ssbd_show_views() { ?>
    
    	<div class="one-half first">
    		<?php genesis_image(); ?>
    	</div>
    
    	<div class="one-half">
    		<?php add_action( 'genesis_post_content', 'summerfield' );
    		function summerfield() {
        		genesis_custom_field( 'ssbd_summerview' );
    		} ?>
    
    		<p>I can get this paragraph to show, but not the image above.</p>
    
    	</div>
    
    <?php }
    
    add_action('genesis_entry_content', 'ssbd_favorite_foods', 10);
    function ssbd_favorite_foods() { ?>
    
    <p><span style="font-weight: 700;">Suggested Feeder Types:</span> <?php genesis_custom_field('ssbd_feedertypes'); ?> <a href="http://wildbirddigest.com/birds/bird-feeders/" title="About Bird Feeders">(about bird feeders)</a></p>
    
    	<div class="one-third first">	<h3>Seeds/Grains</h3>
    		<?php genesis_custom_field('ssbd_favoredseedgrains'); ?>
    		</div>
    	<div class="one-third">	<h3>Fruits</h3>
    		<?php genesis_custom_field('ssbd_favoredfruits'); ?>
    		</div>
    	<div class="one-third">	<h3>Nuts</h3>
    		<?php genesis_custom_field('ssbd_favorednuts'); ?>
    		</div>
    
    <?php }
    
    genesis();
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.