Community Forums › Forums › Archived Forums › Design Tips and Tricks › Items showing up on Blog page but not a page
- This topic has 5 replies, 2 voices, and was last updated 11 years ago by angieatc.
-
AuthorPosts
-
March 20, 2013 at 5:15 pm #29819angieatcMember
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?
My design site, Hill Springs Designs
March 20, 2013 at 11:32 pm #29862Brad DaltonParticipantYeah 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.
is_page_template( ‘page_blog.php' )
Where did you get this code?
Do you want the call to action on single posts or just the blog page?
March 21, 2013 at 4:10 am #29884angieatcMemberI 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.
My design site, Hill Springs Designs
March 21, 2013 at 6:35 am #29911angieatcMemberWhat 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!
My design site, Hill Springs Designs
March 21, 2013 at 6:46 am #29917Brad DaltonParticipantWhere 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
March 21, 2013 at 6:53 am #29921angieatcMemberI 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>
My design site, Hill Springs Designs
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.