• 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

$get_permalink to another post (PHP question)

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 › $get_permalink to another post (PHP question)

This topic is: resolved
  • This topic has 5 replies, 2 voices, and was last updated 12 years ago by Chris Moore.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • December 29, 2013 at 2:40 pm #81907
    Ben @ Inbound Creative
    Member

    Hi guys and girls,

    I'm wracking my head around this one and don't seem to be getting anywhere.

    I've created a more posts section at the bottom of one of my post templates.

    I'm using Nathan Rice's Post Templates plugin to achieve the use of post templates.

    Everything is working fine except for the permalinks for the more posts section.

    I want to call the relevant post's permalink in PHP without needing to code it manually each time I add a new case study.

    I had thought the way to get around this was to add in the following code:
    $get_permalink($post->ID)

    However, this stops the rest of the DIV being called resulting in a blank space.

    The full code for the section is below:

    <div class="more-clients">
    			
    			<h1>More Success Stories</h1>
    			
    				<?php
    					
    					$cat_id = 46; //the certain category ID
    					$latest_cat_post = new WP_Query( array('posts_per_page' => 12, 'category__in' => array($cat_id)));
    					if( $latest_cat_post->have_posts() ) : while( $latest_cat_post->have_posts() ) : $latest_cat_post->the_post();  ?>
    
    					<a href="<?php $get_permalink ?>"><div class="clients-more-box">
    
    					<?php $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) );
    	printf( $img ); ?>
    	
    						<div class="clients-more-box-text">	
    	
    							<p class="clientsmore-client"><?php echo get_post_meta($post->ID, 'Company', true);?></p>
    		
    							<p class="clientsmore-subheader"><?php the_subheading(); ?></p>
    	
    						</div>
    
    					</div></a>
    
    					<?php endwhile; endif;
    				
    				?>
    			
    			</div>

    The page is currently behind a coming soon wall, but I can remove that if you need me to.

    Thanks in advance


    Award winning web design in Liverpool | UK based Genesis Framework web designer and developer

    December 29, 2013 at 3:27 pm #81916
    Chris Moore
    Member

    I'm not that adept at PHP, but I wanna see if this works. 😉

    Try this:

    href="<?php '. get_permalink() .'?>"

    Or this?

    href='<?php echo get_permalink($post->ID); ?>'


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

    December 29, 2013 at 4:10 pm #81923
    Ben @ Inbound Creative
    Member

    Second one worked. I had a horrible gut feeling it was going to be something like echoing the string.

    Thanks Chris!


    Award winning web design in Liverpool | UK based Genesis Framework web designer and developer

    December 29, 2013 at 4:11 pm #81924
    Chris Moore
    Member

    No way!!! Haha... Victory!

    You're welcome.

    Can you try this though:

    href="<?php echo get_permalink($post->ID); ?>"

    With the double instead of single quotes... Just curious.


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

    December 29, 2013 at 4:56 pm #81927
    Ben @ Inbound Creative
    Member

    I put it in double quotes from the off. Just realised you'd put it in single quotes the first time round. I'd copy and pasted the bit between the <>s.

    And haha. That's exactly the same expression I had when it worked.

    Everytime you think you've got your head around PHP, it throws you another curveball.


    Award winning web design in Liverpool | UK based Genesis Framework web designer and developer

    December 29, 2013 at 10:20 pm #81966
    Chris Moore
    Member

    Awesome man! Glad it worked out. Looks like this one is "Resolved"! 🙂


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

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

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