Master/Child Pages in PGWP

My home page will be drastically different from my archive, 404, single, etc pages. It’ll probably have the same menu.
Do I use a second master pages for all the pages except the home page?

If so, how?

sorry for the noob questions.

If you’re not using a significant number of common elements on all your pages, do you really need a master page? Just wondering? I haven’t yet tried to use the Master Page feature.

1 Like

It’s seems it’s required by PG. when making WordPress websites anyway…

If your header and footer will the the same the most direct route would be to create a front-page.html page and use your current master page as it’s master page. Just make sure your “the_content” div (in your master page) is set to editable area so you can remove/add what ever you need on the new front-page.html file.

1 Like

Now that I’m getting into it a little more it seems that PG, when making wordpress websites anyway doesn’t really do the traditional “propogate changes to child pages” thing…

True? Or am I just missing it?

The solution is to use Define Master Page.
It will allow you to create additional master pages for your theme.
Each new master page will have its own header and footer (page name will be used as a slug for header and footer) and will not use the bits from the main master page.

define_master_page

Note: With Pinegrow, defining a “master page” is our way to allow you to easily “create” (automatically or by using the Site content action) the header and footer parts which are needed in any guidelines compliant WordPress theme.

3 Likes

Thanks for chipping in now. I think get it.

You can also setup secondary pages using PG and PHP, so for instance, if you do pagination and they go to pages 2+, then they’ll see something different. Just a thought.

Came back to edit this real quick… sorry, tired, didn’t think I just dropped this without explanation, and maybe @Emmanuel may have some feedback that’s more elegant.

For example, I added a function for an alternate template in my functions.php file:

function inner_index( $template ){
	if ( is_home() && is_paged() ){
		$alternate_template = locate_template( 'inner.php');
		if(!empty( $alternate_template ))
			$template = $alternate_template;
	}
	return $template;
}
add_filter('template_include','inner_index');

Then, in my main loop on index.php, I checked the box to have the parms to to their own block for the array, so I could manually edit them, and included the $paged reference so that WP would know which page it was on, specifically, so that it didn’t get lost in the loop:

<?php
            	$paged = ( get_query_var( 'paged') ) ? get_query_var( 'paged') : 1;
                $blogmain_args = array(
            	'post_type' => 'post',
            	'post_status' => 'publish',
            	'posts_per_page' => '5',
            	'paged' => $paged,
            	'order' => 'DESC',
            	'orderby' => 'date'
            )
        ?>
        <?php $blogmain = new WP_Query( $blogmain_args ); ?>

So then, I just go into my loop parameters, as I need it for the site I’m working on. At the end, I can use it with the pagination by doing this:

<?php wp_bootstrap_pagination( array(
                        	'custom_query' => $blogmain,
                        	'previous_string' => '<span class="fa fa-angle-double-left"></span>',
                        	'next_string' => '<span class="fa fa-angle-double-right"></span>'
                    ) ); ?>

I hope this is helpful to you if you ever wanted to try and use inner pages that have different layouts to display loop data. This is the code from my own developer’s blog I built for small business owners. I also set it up with a split/continued loop due to layout breaks, also. Just things I’ve picked up after doing this full-time for a few years, plus I’m still in a training program through my state for military veterans. If you ever get stuck, the Codex is an awesome resource, and I access it on the desktop through Zeal. It’s been helpful, passing it along!

I’ll put a link in the Slack channel to this, they may also find it useful. Definitely use it as an example of how to do this with your own infrastructure as needed, and look up what I’ve done on Codex (break it down). It just takes time, this is a lot of muscle memory and just repetition.

4 Likes

Thanks, this way past what I’m trying to do right now. But in the future the sky’s the limit so who knows.

Thanks for that helpful tutorial there. That may come in handy for others too now that it is here. Great. Its beyond my pay scale at the moment but I will look at it again in the future.
I was just saying thanks for the heads up on Zeal too! I had never heard of that, I am currently using Dash , unpaid as of yet, just waiting for the delay to pass when using it, as an otherwise fully functioning document reader. So cheers for that. Also, I no that Dash let Zeal use some of their docsets! thats nice of them :slight_smile:

1 Like