• 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

How to add 'Back to Blog link' from a website 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 › How to add 'Back to Blog link' from a website page?

This topic is: not resolved

Tagged: Backtoblog link, linking pages

  • This topic has 9 replies, 2 voices, and was last updated 11 years, 3 months ago by varshasalvi.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • August 6, 2014 at 8:35 pm #117500
    varshasalvi
    Member

    Hello ,

    I am trying to add a link which says "Back to Blog" on the Art-Gallery page of my site.

    Within the art-gallery which is using a jetpack plugin to display slideshow of images , I have managed to put a 'Back To Art Gallery' link on the slideshow page to go back to the main page. I did this by adding
    BACK TO PORTFOLIO, a simple codeline on each gallery page that I created.

    However I am not able to figure out how to add a 'back to blog' link from the main art-gallery page. Is it as simple as adding the above code ? if yes where should I place it?

    my site is : designforsoul.com
    Thanks!

    http://designforsoul.com
    August 6, 2014 at 8:43 pm #117501
    Brad Dalton
    Participant

    Hello Varsha

    Firstly, you need to decide which hook position you want the link to display.

    genesis_after_loop maybe a good hook

    Then you can hook it in using a custom function and conditional tag

    In your case, the conditional tag will be something like

    if ( is_post_type_archive('art-gallery') )
    

    Tutorials for StudioPress Themes.

    August 7, 2014 at 1:09 pm #117621
    varshasalvi
    Member

    Hi Brad,

    I am using this code :

    add_action( 'genesis_after_loop', 'wpsites_hook_back-to-blog', 25 );
    function wpsites_hook_back-to-blog() {
    if ( is_post_type_archive('art-gallery') ) {
    echo'<div class="custom-back-to-blog">';
    echo'BACK TO BLOG';
    echo'</div>';
    }
    }
    But it is giving me an error! I got this snippet from the link you provided above and changed the genesis-before-loop to after , changed the conditional tag and button class to back-to-blog class i created in CSS.

    Could you tell me where am I going wrong?

    August 7, 2014 at 7:54 pm #117685
    Brad Dalton
    Participant

    Please embed the code correctly using Github Gists

    Whats the error message and where did you paste the code?


    Tutorials for StudioPress Themes.

    August 7, 2014 at 8:01 pm #117688
    Brad Dalton
    Participant

    Here's what the code does:

    Portfolio

    You can change the text and style or remove the button so its simply a text link by removing the CSS


    Tutorials for StudioPress Themes.

    August 7, 2014 at 8:56 pm #117697
    varshasalvi
    Member

    I pasted the code in the functions.php folder of my current child theme which is 'Beautiful Pro'.

    I did use Notepad++ to copy the code first

    August 7, 2014 at 11:17 pm #117708
    Brad Dalton
    Participant

    Which code snippet?

    There's 2

    The first one only works in the template file and the 2nd only works in the functions file.

    You can just copy and paste code into any file and expect it to work and not cause problems.

    Also, the HTML needs to go in a text widget and won't work in the functions file.

    Whats the error message?


    Tutorials for StudioPress Themes.

    August 8, 2014 at 2:18 pm #117814
    varshasalvi
    Member

    I got it it to work . I do not not have a knowledge about php but I am learning as i go . I made a mistake in the loop
    add_action( ‘genesis_after_loop’, ‘wpsites_hook_button’, 25 );
    function wpsites_hook_button()
    I changed button with back to blog.

    However, now its a button on the page and if I change the CSS to make it look like a link the css of other buttons on the page also changes.
    Is there a way to avoid that ? I am thinking I will have to create like another custom(button/link or something)
    Also, if I have to do the same thing for portfolio page , i have to just replace the conditional tag to

    if ( is_post_type_archive('portfolio') )

    right?

    August 8, 2014 at 9:54 pm #117863
    Brad Dalton
    Participant

    Just create a HTML link in a new post draft and replace that with the code for the button like this:

    echo' Your HTML link goes here ';
    

    Do the same for the portfolio CPT yes


    Tutorials for StudioPress Themes.

    August 9, 2014 at 12:53 pm #117955
    varshasalvi
    Member

    Perfect ! Thanks Brad.

    I am facing one more issue though:(

    I am using the same code for Portfolio CPT and its not working

    add_action( 'genesis_after_loop', 'wpsites_hook_button', 25 );
    function wpsites_hook_button() {
    if ( is_post_type_archive('portfolio') ) {
    echo'<div class="back-to-blog">';
    echo'BACK TO BLOG';
    echo'</div>';
    }
    }

    The error is that the page just goes blank when I update the functions.php file. Have no idea why this is happening.

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 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

© 2025 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