• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Adding a custom 'After Entry' for a specific page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding a custom 'After Entry' for a specific page

This topic is: resolved

Tagged: after entry widget, custom after entry widget

This topic contains 11 replies, has 3 voices, and was last updated by  braddalton 5 years, 11 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • March 15, 2015 at 2:50 pm #144536

    alethamcmanama
    Member

    I want to be able to add a custom "after entry" widget on this page (see page below) instead of it taking the visitor back to the main blog archives page I set up, I want it to take the visitor to the testimonials page which is an archive of testimonial blog posts.

    Single "Testimonials" post page:
    http://srinikahealing.com/draft/my-skin-condition-gradually-went-away-within-two-months-k-h/

    I was hoping i could use the Simple Sidebar plugin to do this, but the bottom of the blog page is not considered a sidebar.

    Thanks in advance for your help!

    Warmly,
    Aletha McManama

    http://srinikahealing.com/draft/my-skin-condition-gradually-went-away-within-two-months-k-h/
    March 15, 2015 at 6:28 pm #144553

    Christoph
    Member

    Are you using a category for your testimonials?

    You would have to use a conditional function, so that if the category is testimonial it links to the testimonial archive, and if it isn´t it links to the "regular" archive.

    Something like:

    function link_testimonial_blog_archive () {
    	if (  is_category('name_or_id_of_your_category' )  )  {
    	echo '<a href="link_to_your_testimonial_archive"><img src="link_to_your_image">Back to Testimonials</a>';
    } else {*Whatever you have in your after entry widget now*}
    };
    
    add_action( 'genesis_after_entry', 'link_testimonial_blog_archive' );

    You can enter this in the simple hooks plugin at the genesis_after_entry Hook. Remember to check "Execute php on this hook?"
    Or you can add it to the functions.php.

    If you are using the after entry widget area, make sure to delete its content.

    For more on conditionals take a look here:
    http://codex.wordpress.org/Conditional_Tags


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 24, 2015 at 7:23 am #145454

    alethamcmanama
    Member

    Christoph,

    I attempted to add the above in the functions.php file, but I got an error message that read this:

    Parse error: syntax error, unexpected '*' in /home/content/37/8755837/html/draft/wp-content/themes/enterprise-pro/functions.php on line 152

    Maybe I placed it incorrectly in the functions.php file?

    Below is what I pasted in the functions.php file based on what you said add in:

    function link_testimonial_blog_archive () {
    if ( is_category('testimonials' ) ) {
    echo 'Back to Testimonials';
    } else {*<p><span style="text-decoration: underline;">
    back-arrow-burg_25x25pxBack to Blog Archives
    </span></p>*}
    };

    add_action( 'genesis_after_entry', 'link_testimonial_blog_archive' );

    Did I input something above incorrectly?

    Help?

    Thanks so much!

    Warmly,
    Aletha McManama

    March 24, 2015 at 7:44 am #145458

    Christoph
    Member

    Hi Aletha,

    just remove the *.

    I should have clarified that I used them as placeholders.

    *Whatever you have in your after entry widget now*


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 24, 2015 at 7:51 am #145460

    alethamcmanama
    Member

    Christoph,

    I did actually remove those asterisks earlier, then saved, but still got the parse error above. Maybe I placed the code in the wrong place in the functions.php file? I had originally placed it at the bottom of the functions.php file, but then tried the middle and still got the error message. Any other ideas?

    Thanks!

    Aletha

    March 24, 2015 at 8:08 am #145465

    Christoph
    Member

    Hi Aletha,

    can you paste the code again using the code tags?
    It´s the second from the right on top of this editor.
    One before the code and one after.
    Otherwise the code gets formatted and it´s hard to tell if there is something wrong with it.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 24, 2015 at 8:13 am #145468

    alethamcmanama
    Member
    function link_testimonial_blog_archive () {
    	if (  is_category('testimonials' )  )  {
    	echo '<a href="http://srinikahealing.com/draft/testimonials/"><img src="http://srinikahealing.com/draft/wp-content/uploads/2015/01/back-arrow-burg_25x25px.png">Back to Testimonials</a>';
    } else {*<p><span style="text-decoration: underline;"><strong><a title="Blog" href="http://srinikahealing.com/draft/blog-summary/">
    <img class="alignleft size-full wp-image-2603" src="http://srinikahealing.com/draft/wp-content/uploads/2015/01/back-arrow-burg_25x25px.png" alt="back-arrow-burg_25x25px" width="25" height="25" border="0" />Back to Blog Archives</a></strong></span></p>*}
    };
    
    add_action( 'genesis_after_entry', 'link_testimonial_blog_archive' );
    March 24, 2015 at 8:58 am #145472

    Christoph
    Member

    Hi,

    this should work now:

    function link_testimonial_blog_archive () {
    	if ( in_category('testimonials') )  {
    	echo '<a href="http://srinikahealing.com/draft/testimonials/"><img src="http://srinikahealing.com/draft/wp-content/uploads/2015/01/back-arrow-burg_25x25px.png"><p><span style="text-decoration: underline;"><strong>Back to Testimonials</strong></span></p></a>';
    } else {
    	echo '<a href="http://srinikahealing.com/draft/blog-summary/"><img class="alignleft size-full wp-image-2603" src="http://srinikahealing.com/draft/wp-content/uploads/2015/01/back-arrow-burg_25x25px.png" alt="back-arrow-burg_25x25px" width="25" height="25" border="0" /><p><span style="text-decoration: underline;"><strong>Back to Blog Archives</strong></span></p></a>';}
    	};
    add_action( 'genesis_after_entry', 'link_testimonial_blog_archive' );

    I liked it better to place the links above the comments. That would be this action hook instead:
    add_action( 'genesis_entry_footer', 'link_testimonial_blog_archive' );


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 24, 2015 at 9:19 am #145475

    alethamcmanama
    Member

    Awesome, Christoph. That really worked! And, yes, I like the links to be placed above the comments, so I went with the action hook above.

    One more question though and then I'm done:

    Is there any way to not have the "blog archives" image and link not show up on this page (link below) where I have a layout view of just one blog post and I have a link to go to the blog archives page already? I don't need it to show up twice, plus for some reason, my arrow image is squashed down to where you can't even see it at the bottom of that page.

    Here's the page I'm referring to: http://srinikahealing.com/draft/blog/

    You've been SO helpful in me resolving this issue. I cannot WAIT to get this website completed!

    Warmly,
    Aletha

    March 24, 2015 at 10:51 am #145482

    Christoph
    Member

    Let me know if this works:

    
    function link_testimonial_blog_archive () {
    	if ( is_single && in_category('testimonials') )  {
    	echo '<a href="http://srinikahealing.com/draft/testimonials/"><img src="http://srinikahealing.com/draft/wp-content/uploads/2015/01/back-arrow-burg_25x25px.png" /><p><span style="text-decoration: underline;"><strong>Back to Testimonials</strong></span></p></a>';
    } elseif ( is_single() ) {
    	echo '<a href="http://srinikahealing.com/draft/blog-summary/"><img src="http://srinikahealing.com/draft/wp-content/uploads/2015/01/back-arrow-burg_25x25px.png" alt="back-arrow-burg_25x25px" width="25" height="25" border="0" /><p><span style="text-decoration: underline;"><strong>Back to Blog Archives</strong></span></p></a>';}
    	else {
    	echo '' ;}
    	};
    	
    add_action( 'genesis_entry_footer', 'link_testimonial_blog_archive' );

    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 24, 2015 at 11:13 am #145493

    alethamcmanama
    Member

    That did the trick this time, Christoph. Again, thank you for all your time in helping me resolve this. I've learned something new about the Genesis themes today!

    Warmly,
    Aletha

    March 24, 2015 at 6:59 pm #145565

    braddalton
    Participant

    Or you could use your native Custom Fields


    2600 Genesis Tutorials

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 total)

The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2021 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble