0

I have created four custom PHP file pages

 page-about.php
 page-services.php
 page-portfolio.php
 page-contact.php

I have entered custom php code for every page that will show up on the homepage as a one-page site that has sections (section 1, section 2, section 3, section 4, section 5).

When every you click on the top navigation links where the Home, About, Services, Portfolio, Contact going to scroll down to each section on the page rather than going to each individual pages.

Below is the code I entered for the front-page.php and I was attempting to try a code that I find on stackoverflow.com that might help me solve my problem. But when every try the code for first time nothing has changed on front-page also him still learning Wordpress and PHP.

Example what him trying to with my Wordpress Theme Site http://themeisle.com/demo/?theme=Parallax%20One

<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">

            <?php           
                    $args = array (
                        'post_type'              => 'page',
                        'post_parent'            => '29',
                        'orderby'                => 'menu_order',
                        'order'                  => 'ASC',
                    );

                    $query = new WP_Query( $args );


                    if ( $query->have_posts() ) {

                        while ( $query->have_posts() ) {

                            $query->the_post();
                            $tn = get_page_template_slug( $post_id );
                            $word = array("page-", ".php",' ');
                            $template = str_replace($word,'',$tn);

                            get_template_part('page', $template);
                        }

                    } else {

                    }  

                    wp_reset_postdata();    

            ?>

    </main><!-- #main -->
</div><!-- #primary -->

enter image description here

8
  • "not working" is a bit too vague for anyone to help you, maybe you need to add more information.
    – majick
    Jul 10, 2016 at 13:49
  • @majick You have an Skype where I can explain in a Skype call little much better and also do a screen share of the code. Jul 11, 2016 at 1:41
  • the code is there, just not the question. if you can explain it better, you can do so in your question too. blog.codinghorror.com/rubber-duck-problem-solving
    – majick
    Jul 11, 2016 at 6:20
  • @majick I have fix the question and explain little bit so people can understand what trying to do on first Wordpress Theme. Jul 13, 2016 at 19:38
  • When you say nothing happened on front-page you mean that nothing has changed? You have a front-page set in Settings -> Reading and are sure that it is attempting to pull this template? Have you verified that the children under Post Parent 29 have the slugs about or services?
    – Howdy_McGee
    Jul 13, 2016 at 19:55

1 Answer 1

0

May be you need this theme... Try it out it's a free theme and same as per your requirement. It's a one page website theme available on wordpress.org.

https://wordpress.org/themes/one-page/

Check out the demo here

https://wp-themes.com/one-page/

2
  • Does not Solve my question but thank you for help me. Jul 14, 2016 at 8:58
  • It's not exactly a one page site.
    – Lisa
    Apr 17, 2017 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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