Jump to content
Sign in to follow this  

Custom Post Type, Custom Query, Custom Template

Recommended Posts


I cannot get pagelines to save and apply the column layouts. It presents the text in full-page-width form, no matter what I do. It does not output the divs and class info needed to render the column. I've created a custom page using a custom template and a custom section. The admin page for the custom page does show the drop down that lets me select 'one column on left', and it appears to save the results, but the output is not affected. It ignores whatever I select. I can find no documentation on the "__construct" function so I can't really understand what the parameters do and I suspect it might be something in there. Here is the URL of the page I'm working with: http://www.capitalismv3.com/?page_id=2106 It is a glossary of terms. I have done the following: 1) Created new page template page.glossary.php. It contains only the following text:

	Template Name: Glossary
2) I've created a section: section.glossary.php. It contains:
		Section: Glossary Loop
		Author: Curt
		Description: Paginates glossary pages, shows a numerical post navigation
		Version: 1.0.0
	class CDGlossaryLoop extends PageLinesSection {
	   function __construct( $registered_settings = array() ) {
			$name = __('Glossary Content', 'pagelines');
			$id = 'cdglossaryloop';
			$settings = array(
				'type' 			=> 'glossary',
				'description' 	=> 'The Glossary Loop. Includes post information',
				'workswith' 	=> array('main-single', 'main-default', 'main-posts', 'glossary'),
				'posttype'		=> 'glossary',
				'initfile'		=> 'glossary',
				'icon'			=> PL_ADMIN_ICONS . '/document.png'
		   parent:GDN__construct($name, $id, $settings);
		function section_persistent(){
			$global_meta = array(
				'_pagelines_layout_mode' => array(
					'type' => 'select',
					'selectvalues'=> array(
						'fullwidth'				=> array( 'name' => 'Fullwidth layout', 'version' => 'pro' ),
						'one-sidebar-right' 	=> array( 'name' => 'One sidebar on right' ),
						'one-sidebar-left'		=> array( 'name' => 'One sidebar on left' ),
						'two-sidebar-right' 	=> array( 'name' => 'Two sidebars on right', 'version' => 'pro' ),
						'two-sidebar-left' 		=> array( 'name' => 'Two sidebars on left', 'version' => 'pro' ),
						'two-sidebar-center' 	=> array( 'name' => 'Two sidebars, one on each side', 'version' => 'pro' ),
					'title' => 'Content Section - Select Layout Mode (optional)',
					'desc' => 'Use this option to change the content layout mode on this page.'
			add_global_meta_options( $global_meta );
	   function section_template() {
		get_template_part ('template.glossaryloop');
		End of section class
3) I've created: platformbase/template.glossaryloop.php This file is a duplicate of template.postloop.php except that it uses a different query, and some of the code is removed (get_tags is hard coded rather than a hook that can be turned off) 4) I've modified functions.php: a) Adding the custom post type.
function register_glossary_custom_post_type() {
	// Creates Definitions post type
	register_post_type('definitions', array(
	'label' => 'Definitions',
	'public' => true,
	'show_ui' => true,
	'capability_type' => 'post',
	'hierarchical' => false,
	'rewrite' => array('slug' => 'definitions'),
	'query_var' => true,
	'supports' => array(
	) );
	add_action( 'init', 'register_glossary_custom_post_type' );
B) Adding a base page:
	// Add Base Page
	if ( function_exists( 'pagelines_add_page' ) ) pagelines_add_page('glossary', 'Glossary');
c) Registering a section:
	pagelines_register_section('CDGlossaryLoop','glossary', null, array('child' => true) );

So that's what I've done. Any help?

Share this post

Link to post
Share on other sites

Well, does it mean I have to wade through the source and figure out how the layout logic works? I'm pretty sure I shouldn't need to..

Share this post

Link to post
Share on other sites

I don't think you need to call the _pagelines_layout_mode...also, if you create a new section you can create the custom post type from within the section. Use the Banners as a working example. Layout wise what is printed as the meta option for that page when you dump?

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