Jump to content
Sign in to follow this  
carldavaz

Custom post type: Not showing on homepage

Recommended Posts

carldavaz

I am using the plugin "pagelines-customize". I put the below custom post type in the functions.php file:

# Custom post types:
	register_post_type(
		'oregon_football',
		array(
			'label' => __('Oregon Football'),
			'singular_label' => __('Oregon Football'),
			'public' => true,
			'show_ui' => true,
			'capability_type' => 'post',
			'hierarchical' => false,
			'rewrite' => false,
			'query_var' => true,
			'rewrite' => array('slug' => 'oregon-football'),
			'supports' => array(
				'title',
				'editor',
				'author',
				'excerpt',
				'trackbacks',
				'custom-fields',
				'comments',
				'revisions',
				'thumbnail',
				'page-attributes',
			)
		)
	);

Everything works great, but how do I get a custom post type to show on the homepage of my Pagelines template? I am sure I a missing something obvious here. The new pageline docs/WIKI don't appear to have any information, and all the forum hits appear to contain information that refers to PlatformPro. Any tips ya'll could provide would be awesome! Thanks! Micky

Share this post


Link to post
Share on other sites
carldavaz
Hi Catrina! Thanks again for you help! I really appreciate it. Currently, it just shows the default "hello world" blog post. When viewing the post via the admin, I can visit it's permalink without a problem. I just don't understand what would block this post from showing on the homepage. I did [url="http://www.pagelines.com/forum/discussion/12144/custom-post-types/p1"]find this code[/url], but it did not work for PageLines framework when pasted it into functions.php via the "pagelines-customize" plugin (I assume that there is a difference between PlatformPro and PageLines framework in terms hooks?) Hmmm, maybe I need to look at documentation on the PageLines API? Other info: The theme is PageLines default. WP and Pagelines are on the latest versions. I am new to WP and PL. :) Sorry if this is a noob question. Thanks so much!!! Cheers, Micky

Share this post


Link to post
Share on other sites
carldavaz
I just noticed that when I go to edit functions.php in pagelines-customize plugin, the header says: [code]Editing pagelines-customize/functions.php [b](inactive)[/b][/code] Why does it say inactive? Why do some say "(inactive)" whilst others say "(active)"? I am pretty sure my PHP code is sound; not to mention that the custom post type appears in my sidebar admin menu. Thanks! Micky

Share this post


Link to post
Share on other sites
carldavaz
Adding the below code to functions.php in pagelines-customize plugin allowed my custom post to show on the theme homepage: [code]add_filter('pre_get_posts', 'my_get_posts'); function my_get_posts($query) { if (is_home() && false == $query->query_vars['suppress_filters']) { $query->set('post_type', array('post', 'oregon_football')); } return $query; }[/code] Hmmm, I guess the [url="http://www.pagelines.com/forum/discussion/12144/custom-post-types/p1"]suggestion/example code found in this thread[/url] is outdated (which is unfortunate, because I don't like the thought of having to add new custom post types to $query->set() like in the above code). I still don't get why it says "[b](inactive)[/b]". :)

Share this post


Link to post
Share on other sites
catrina
Yeah, I notice that it says "inactive" but I can't explain why. When it was explained to me, it was something that shouldn't be a cause for too much concern (it's something that has to do with the framework).

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
carldavaz
Sounds good! Thanks for all of your help Catrina, I really appreciate it. :)

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  

×