Items showing up on Blog page but not a page

Community Forums Forums Design Tips and Tricks Items showing up on Blog page but not a page

This topic is: not resolved

This topic contains 5 replies, has 2 voices, and was last updated by  angieatc 1 year, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29819

    angieatc
    Participant
    Post count: 80

    This might be a little bit more than what the forums are intended for but I thought I would ask just in case someone could give me a hint/help on this. The site is http://angiesweigh.com

    I have a call to action and I need it to show up on the blog page below the posts but not on any of the other pages nor the home page. This is what I had originally:

    This is what I have for the conditional tag and it did not work and I am guessing it is because I had 2 is_page:

    /** Add Genesis Box on Single Posts */
    add_action( ‘genesis_after_post_content’, ‘include_call_to_action’, 11 );
    function include_call_to_action() {
    if(!is_home()&& !is_page()&& is_page( 27 ) )
    require( CHILD_DIR.’/call-to-action.php’ );
    }

    Then I went back to the conditional tags on the Codex and thought this one would work: is_page_template( ‘about.php’ ) but use blog.php instead so it would look like this:

    /** Add Genesis Box on Single Posts */
    add_action( ‘genesis_after_post_content’, ‘include_call_to_action’, 11 );
    function include_call_to_action() {
    if(!is_home() && !is_page() && is_page_template( ‘blog.php’ ) )
    require( CHILD_DIR.’/call-to-action.php’ );
    }

    but that did not work either. Is the blog page a blog.php file?

    #29862

    braddalton
    Participant
    Post count: 9944

    Yeah it is but its in the core Genesis files and its actually named page_blog.php so you may need to use the post i.d for the blog page instead if it doesn’t work in a conditional tag.
    [php]
    is_page_template( ‘page_blog.php’ )
    [/php]
    Where did you get this code?

    Do you want the call to action on single posts or just the blog page?


    #29884

    angieatc
    Participant
    Post count: 80

    I will try that when I get to my computer. I would like it to show on individual posts, which it does, and the blog post page because those are full posts as well.

    #29911

    angieatc
    Participant
    Post count: 80

    What is weird is when I add the is_page_template to the functions my call to action is removed from the individual posts. Here is what I have when I add the is_page_template


    /** Add Genesis Box on Single Posts */
    add_action( 'genesis_after_post_content', 'include_call_to_action', 11 );
    function include_call_to_action() {
    if(!is_home()&& !is_page()&& is_page_template( ‘page_blog.php’ ))
    require( CHILD_DIR.'/call-to-action.php' );
    }

    Thanks again for the help!

    #29917

    braddalton
    Participant
    Post count: 9944

    Where did you get the code from?

    Why don’t you add a widget or try one of these code snippets https://gist.github.com/braddalton


    #29921

    angieatc
    Participant
    Post count: 80

    I had a friend write it for me. She is not available right now so that is why I asked in here. I have a post after widget but when I add the code that is in the call-to-action.php file the pin it option goes away.

    This is what is in the call-to-action.php file

    <div id=”call-to-action”>
    <p align=”center”><a href=”<?php comments_link(); ?>”><img src=”http://angiesweigh.com/wp-content/uploads/2013/03/comment.png” alt=”Comments” /></a><a href=”https://www.facebook.com/pages/Angies-Weigh/607548645939464″ target=”blank”><img src=”http://angiesweigh.com/wp-content/uploads/2013/03/followfb.png” alt=”Facebook” /></a><? pinterest_share_button(); ?><!– Lockerz Share BEGIN –>
    <a class=”a2a_dd” href=”http://www.addtoany.com/share_save”><img src=”http://angiesweigh.com/wp-content/uploads/2013/03/shareit.png” width=”154″ height=”39″ border=”0″ alt=”Share”/></a>
    <script type=”text/javascript” src=”http://static.addtoany.com/menu/page.js”></script>
    <!– Lockerz Share END –><a href=”http://angiesweigh.com/contact/”><img src=”http://angiesweigh.com/wp-content/uploads/2013/03/contactme.png” /></a></p>
    </div>

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.