Jump to content
Sign in to follow this  
sanderpinkse

Child section not working

Recommended Posts

sanderpinkse

I'd like to use a modified version of section.postsinfo.php (to set up a proper header for a page that displays the results of a query for a custom taxonomy). That works fine if I modify section.postsinfo.php directly in Platformpro, but when I put a copy in my Platformbase child theme -- the preferred way, of course -- WordPress still uses the file from Platformpro. It doesn't matter if I place my modified section.postsinfo.php in a 'sections' folder or a 'wp' sunbfolder. Can anybody enlighten me? Cheers, Sander

Share this post


Link to post
Share on other sites
cmunns

You should be adding a file called template.postsinfo.php to the root of your Base theme. What goes inside of it for editing is ONLY what is inside of the section_template function of the original section.postsinfo.php

Share this post


Link to post
Share on other sites
sanderpinkse

Ah... That solved my problem. Now it works like a charm. Thanks a lot!

Share this post


Link to post
Share on other sites
evert100

@Adam: How does this work for for instance the file library.templates.php? I made about 6 or 7 file customizations. Is there a standard rule of re-naming the files?

Share this post


Link to post
Share on other sites
cmunns

library.templates.php shouldn't be touched. All the functions in that file have filters so that you can modify them in the functions.php file of your child theme. What is an example of something you changed?

Share this post


Link to post
Share on other sites
evert100

Adam, primarly translations to Dutch like this: "if(pagelines_option('byline_author')){ $metabar .= sprintf( '<span class="sword">%s</span> [post_author_posts_link] ', __('door','pagelines') ); } if(pagelines_option('byline_date')){ $metabar .= sprintf( '<span class="sword">%s</span> [post_date] ', __('op','pagelines') ); }

Share this post


Link to post
Share on other sites
evert100

And other files also for translation. Is there a more subtle way of doing this?

Share this post


Link to post
Share on other sites
evert100

Don't know what happened, but after following the example in the topic you named Tim my website froze and i couldn't login to admin. Big stress. Took me a couple of hours to restore the whole thing. I feel uncomfortable with these hooks. I need a step by step guide, because i dont get the php code enough. But I want to learn this. Is there a tutorial for dummies? So i can learn to make hooks, actions and custom page templates?

Share this post


Link to post
Share on other sites
evert100

Catrina, i would appreciate some step-by-step help. To begin simple. I changed (just for dutch translation) the following in comments.php

if ( have_comments() ) : ?> <h3 id="comments-title"><?php printf( _n( '1 reactie op %2$s', '%1$s reacties op %2$s', get_comments_number(), 'pagelines' ), number_format_i18n( get_comments_number() ), '' . get_the_title() . '' ); ?></h3>
I changed this in platformpro file. Can you guide me how to do this in the platformbase file? Thanx.

Share this post


Link to post
Share on other sites
sanderpinkse

Hi Evert, If translation is the main point, can't you simply edit the .po and .mo-files? That would save a lot of hassle...

Share this post


Link to post
Share on other sites
evert100

I just want to know, as ?  simple starting point, how to do this in THE platform base and then move on to more complicated matters. This most be possible THE way i want isn't it? So Catrina or someone can you give me ?  specific plan how to do this simple thing. Cheers

Share this post


Link to post
Share on other sites
Kate

Hi Evert, Basically, what you would do is copy your file from platformpro to platformbase. Then, simply modify it in platformbase. For some files, it's necessary to maintain the same file structure as is in platformpro. (For instance, if a file is in platformpro/sections, you would need to create platformbase/sections for the file.)

Share this post


Link to post
Share on other sites
evert100

I don't get it. Adam spoke about

renaming section.postsinfo.php to template.postsinfo.php, and putting it in the root of base
Is there a summary which files need a file structure and which don't? Or is it just trial and error? Is there a risk? Last time i got a total crash and it took me several hours to recover.... cheers

Share this post


Link to post
Share on other sites
catrina

You should rename section.postsinfo.php to template.postsinfo.php and then put it in the root of base. If that doesn't work, try Kate's instructions.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
evert100

Hi Catrina, i followed your instructions. The result is that the postinfo doesn't load and the sidebar doesn't show up. Trying Kate's instructions doesn't have any effect. So following the filestructure etc. Dreamweaver asks if i want to change the links but that doesn't have any effect also. What is next? Why doesn't this just work the way Adam described? By the way putting comments.php in the root of base DOES work! Any ideas? Thanx

Share this post


Link to post
Share on other sites
catrina

Going back to Sander's response:

If translation is the main point, can't you simply edit the .po and .mo-files? That would save a lot of hassle...
Have you already tried editing the .po files if you're translating?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
evert100

Hi Katrina, No i didn't try to edit THE translation files. I See this, ad i wrote before, as ?  starting step to more complicated customations. Since both suggestions don't Deen to work. I like to know more about working with hooks. Since working with ?  chips thema is more simple i'd like to know how to handle pro files for this purpoae in THE base folder. Glad if you coups answer To this question. Cheers

Share this post


Link to post
Share on other sites
evert100

last post bit chunky because of Iphone corrections. Seems like i was drinking :-) Hope that you can give me a direction how to do this with filters. Is that possible? Thanx again.

Share this post


Link to post
Share on other sites
sanderpinkse

Hi Evert, Template overrides should work fine for what you are trying to do. Maybe a small real life example will help. I wanted to disable the post navigation for a specific custom post type on my site. For that, I needed to override section.postnav.php (in platformpro/sections/wp). This is the complete contents of that file:

<?php
	/*
		Section: PostNav
		Author: Andrew Powers
		Description: Paginates posts, shows a numerical post navigation
		Version: 1.0.0
	*/
	class PageLinesPostNav extends PageLinesSection {
	   function __construct( $registered_settings = array() ) {
			$name = __('Post Navigation', 'pagelines');
			$id = 'postnav';
			$settings = array(
				'type' 			=> 'main',
				'description' 	=> 'Post Navigation - Shows titles for next and previous post.',
				'workswith' 	=> array('main-single', 'main-default'),
				'folder' 		=> 'wp',
				'init_file' 	=> 'postnav',
				'icon'			=> PL_ADMIN_ICONS . '/map.png'
			);
		   parent:GDN__construct($name, $id, $settings);
	   }
	   function section_template() { ?>
			<div class="post-nav fix">
				<span class="previous"><?php previous_post_link('%link') ?></span>
				<span class="next"><?php next_post_link('%link') ?></span>
			</div>
	<?php }
	}
	/*
		End of section class
	*/
I created a file named template.postnav.php in my platformbase folder. All I added to that file was what's below:
<?php
			if( 'XXXXX' !== get_post_type() ): ?>
			<div class="post-nav fix">
				<span class="previous"><?php previous_post_link('%link') ?></span>
				<span class="next"><?php next_post_link('%link') ?></span>
			</div>
	<?php endif; ?>

'XXXXX' is of course the name of my custom post type. Basically, all you should include in the override template (template.postinfo.php in your case) is the very bit of code you want to customize. If anything goes wrong, simply delete or rename the override template, and your site will be back to its old self. Hope this helps somewhat. Cheers, Sander

Share this post


Link to post
Share on other sites
evert100

@Sander, big thanks. Now i got it to work. Just the chunk of code you want to change is the key! By the way are you dutch like me? Cheers

Share this post


Link to post
Share on other sites
evert100

Sander can you put this topic to 'resolved"? please? I can't because you started it. Thanx again.

Share this post


Link to post
Share on other sites
sanderpinkse

Hi Evert, Glad I was able to help. I changed the status to 'resolved'. And indeed, I am Dutch...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×