Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Post headers on homepage - Link to pages instead? (http://forum.bytesforall.com/showthread.php?t=704)

ray-zin Mar 10, 2009 04:14 AM

Post headers on homepage - Link to pages instead?
 
Hi Is it possibel to change this piece of code in the index.php to point to relevant page slugs instead of post slugs?
Code:

                <h2><?php
                if( !is_single() AND !is_page() ) { ?>
                        <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php
                        if (function_exists('the_title_attribute')) {
                                the_title_attribute();
                        }
                        elseif (function_exists('the_title')) {
                                the_title();
                        } ?>"><?php
                } the_title();
                if( !is_single() AND !is_page() ) { ?>
                        </a><?php
                } ?>
                </h2>

Thanks in advance for your help.

Flynn Mar 10, 2009 03:21 PM

What do you mean with "point to". Provide more details, please

ray-zin Mar 10, 2009 04:40 PM

Hi Flynn.

What I meant is that the piece of code above turns the post header into a link to the post's perm. link.
How can I change this to instead build a url for a different page instead of the post's perm. address?

eg: Lets say the post has a slug of: "target-1" and I give a page that I create the same slug of: "target-1" can this code be changed somehow to point to the PAGE slug instead of the POST slug?

I hope this makes sense. I'm still learning WP and not familiar with all the terms etc.

Flynn Mar 11, 2009 12:46 AM

In that code, replace

PHP Code:

<?php the_permalink() ?>

with

PHP Code:

<?php echo get_option('home') . '/' $post->post_name '/'?>

This would will create http://your-wordpress-base-url.com/post-slug/

ray-zin Mar 11, 2009 03:45 PM

Woohoo!!! Absolutely awesome Flynn...

Thanks.

I now have list of posts that link to static pages as long as I give them the same slugs and ammend the default slug directory.

Brilliant!!!

My page is so far from a blog its not even funny ;-)


All times are GMT -6. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.