Jump to content
Sign in to follow this  
peetred

custom page template and custom section not showing up

Recommended Posts

peetred

Hi, I'm having an issue with creating a custom page template and custom section. I have created one custom section already and am not having a problem with this section showing properly. I'm having problems with my second custom section and my custom page template not showing up in the template setup section of the admin area. The following is the code for my section.archive.php file which is under the base theme and under the sections directory.

<?php
	/*
		Section: Slider Section
		Author: Pruitt Production
		Description: Displays the Archives within a template via drag & drop sections
		Version: 1.0.0
	
		Demonstrates how to create a cool site section in 50 lines of code!
		Note: the only other piece to make this work is the 'pagelines_register_section()' function in your functions.php
	*/
	class Archives extends PageLinesSection {
	   function __construct( $registered_settings = array() ) {
	
			// BASIC INFO
				/* The name and ID of the section */
				$name = __('Archives', 'pagelines');
				$id = 'archives';
	
			// SETTINGS
	
				// Setup description of the section..
				$default_settings['description'] = 'Displays an archive of posts within the content section of your template.';
	
				// The template areas this section works with..
				// Examples areas: 'main', 'content', 'header', 'footer', 'morefoot', sidebar1, array('main', 'content'), etc....
				$default_settings['workswith'] = array('main','content');
	
				// The icon users will see in the admin.. add the full url here
				$default_settings['icon'] = PL_ADMIN_ICONS . '/document.png';
	
			// OPS
				/* Draw section using the section API - don't need to touch this*/
				$settings = wp_parse_args( $registered_settings, $default_settings );
			   	parent:GDN__construct($name, $id, $settings);
	   }
	
		/* Use this function to create the template for the section */
	 	function section_template() {
	
	                                     wp_get_archives( 'show_post_count=true' );
	
	                                    }
		// Some of the optional functions not used here.
		function section_options($optionset = null, $location = null) {} /* Adds Options in the admin. Use this function to add them; see PageLines.com for more info */
		function section_persistent(){} /* Runs in every page, including in admin (not used in this section) */
		function section_head(){} /* Runs in site header, only if section is active (not used here) */
	
	} /* End of section class - No closing tag needed */
Here is the code in my base functions.php file to add the section.
function base_sections(){
	
		/*
			Your custom sections get registered in here...
			PageLines Register Section Arguments:
				1. Section Class Name,
				2. Directory name (or filename if in root of 'sections' folder),
				3. Init Filename (if different from directory name),
				4. Section setup and variable array
	*/
	
			pagelines_register_section('BasePullQuote', 'pullquote', null, array('child' => true) );
			pagelines_register_section('BaseSidebar','sb_base', null, array('child' => true) );
			pagelines_register_section('Slider','slider', null, array('child' => true) );
			pagelines_register_section('Archives','archives', null, array('child' => true) );
		        }
This "Archives" section will not show even though I followed the exact procedure used for my other custom section that does show. Perhaps I made a syntax error somewhere and I just can't see it. I also created an "Archive" custom page template to use in conjunction with the "Archive" section. I followed the instructions for creating custom pages and created this file page.archives.php and copied the code from the base page.
<?php
	if(VPRO) {
	/*
		Template Name: Archives Page
	*/
	
	setup_pagelines_template();
	
	}
I registered the custom page as instructed into my base functions.php file here:
// ADDING NEW TEMPLATES --------//
		// Want another page template for drag and drop? Easy 
		// 			1. Add File called page.[page-id].php to Base
		// 			2. Add /* Template Name: Your Page Name */ and Call to 'setup_pagelines_template();' to that file (see page.base.php)
		// 			3. Add 'pagelines_add_page('[page-id]', '[Page Name]');' to this functions.php file
	
		// Add Base Page
	if ( function_exists( 'pagelines_add_page' ) ) pagelines_add_page('base', 'Custom Page');
	if ( function_exists( 'pagelines_add_page' ) ) pagelines_add_page('archives', 'Archives');[/code]

I see the "Custom Page" template which I copied from but do not see the "Archives" custom page which I am trying to created. What am I missing here? I'm pretty sure my section should be showing at the very least, and my page should show as well. I'm probably missing something silly.

Share this post


Link to post
Share on other sites
Simon

Try changing the classname to something else, Archives is probably used elsewhere...

Share this post


Link to post
Share on other sites
peetred

I didn't think of that. Thanks I'll give that a try.

Share this post


Link to post
Share on other sites
peetred

I did change the classname and the reference to the classname and still nothing. Any more ideas?

Share this post


Link to post
Share on other sites
peetred

I even tried changing the file name from section.archives.php to section.custom_archives.php and all the associated references in functions.php and my renamed section file and still nothing. This is driving me crazy now!

Share this post


Link to post
Share on other sites
peetred

Well I feel like a complete idiot. I found out what my problem was, and it had nothing to do with the coding whatsoever. I had my testing domain admin panel open on the Template Setup page and not on my real domain, hence why it wasn't showing up. DOH! At least I was able to figure out my own silly mistake before getting too many people involved.

Share this post


Link to post
Share on other sites
Simon

Haha, dont worry, it happens to us all the time ;)

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  

×