Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am creating a wordpress CMS and I have added multiple pages under one parent page. I am generating the links for all the child pages of a page and then when user clicks on the links, they should be able to open the child page. How ever when I click on the links, the index page is opened and no child page content is displayed. May be it is due to the use of the .htaccess file. I dont have any knowledge of htaccess. Any help?

<?php
            $pages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );

            foreach ($pages as $page) {
            ?>

                <div class="contentarea">
                <div class="leftside"><img alt="" src="http://zom.jtechsolutions.co/wp-content/themes/zone/images/pic_1.jpg" /></div>
                <div class="rightside">
                <h2><?php echo $page->post_title; ?></h2>
                <?php echo substr(strip_tags($page->post_content),0,50); ?>

                <a href="<?php echo get_post_permalink($page->ID); ?>">Read More...</a>

                </div>
                </div>

            <?php

                }
            ?>  

.htaccess

 # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

# END WordPress
share|improve this question
    
Can you post a link to the problem page? –  s_ha_dum Feb 27 '13 at 23:44
    
@s_ha_dum zom.jtechsolutions.co/services –  sohanmax02 Feb 27 '13 at 23:53
    
Those links look right. Unfortunately your theme is not using body_class so I can't tell what template is loading. –  s_ha_dum Feb 28 '13 at 0:16
    
What's your permalink structure? –  jfacemyer Feb 28 '13 at 4:01
add comment

1 Answer 1

According to the codex, get_post_permalink applies to custom post types. I don't think you are using a custom post type, right?

Instead, try get_page_link( $page->ID )

share|improve this answer
1  
I used it, it is not working either. zom.jtechsolutions.co/services this is the link –  sohanmax02 Feb 28 '13 at 0:02
    
Your links are correct. htaccess is correct. There's something else awry. Have you perhaps edited your page.php to be the home page? –  vancoder Feb 28 '13 at 0:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.