Skip to content (Press Enter)

marioernestoms

WordPress Specialist

  • About

WordPress Theme one page scroll

by marioernestomsupdated on 30 de April de 201910 de February de 2017

First of all, you should create a template file for your one page. Let’s call it template-one-page.php. The template name, commented inside the file, is the name that will appear in Page Attributes -> Template when you creating a page inside admin panel. After that create a page, ie Home, and assign as template your template. If you want your page to appear as front page (when you enter mydomain.com this page will be shown) go to Setting->Reading->Front page displays->A static page and set as front page your page.


<?php 
// File Security Check
defined('ABSPATH') OR exit;
/*

Template Name: One Page

*/
?>

Normally a one page has sections. So we want to decide what type of sections we want. It could be pages, child pages, posts, custom fields (like a repeater from ACF) etc.


$id = get_the_ID(); // The page id

$sections = get_posts(array('post_type' => 'page', 'post_parent' => $id)); // get all child pages

foreach ($sections as $key => $section):

ID); ?>> echo get_the_title($section->ID);
endforeach; Or with a Loop $id = get_the_ID(); // The page id $query = new WP_Query( array('post_type' => 'page', 'post_parent' => $id) ); // get all child pages if($query->have_posts()): while ( $query->have_posts() ) : $query->the_post();
>

endwhile; wp_reset_postdata(); endif;

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

WordPress
1

marioernestoms

Post Navigation

Previous Article
Next Article

Recent Posts

  • WooCommerce – Block add to cart button
  • WooCommerce – Remove add to cart button
  • Ajax Login System with WordPress
  • How to install WordPress on VPS with SSH
  • Troubleshoot WordPress update failure message

Categories

  • HTML/CSS/JS
  • Servidores
  • WordPress
Recommended for you...

Ajax Login System with WordPress

by marioernestoms
Recommended for you...

WooCommerce – Block add to cart button

by marioernestoms
An automated wordpress update failure
Recommended for you...

Troubleshoot WordPress update failure message

by marioernestoms

1 Comment

  1. marioernestoms
    24 de February de 2017 at 20:27
    Reply

    test comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© Copyright 2021 marioernestoms. All Rights Reserved. The Ultralight | Developed By Rara Theme. Powered by WordPress.