Jump to content
Sign in to follow this  

Subnav categories Platform pro

Recommended Posts


Thank You. Yes - I am using child base theme and I placed the template file in the root. But what code do I put in it to get the loop work? I am not comfortable with coding, so I am now reading about the loop code.

Share this post

Link to post
Share on other sites

I've made a step forward! In the "Map categories to pages" plugin code

	Plugin Name: Map Categories to Pages
	Plugin URI: http://amit.me/WP-Plugins
	Description: Displays categories box on "Edit Page" page.
	Version: 1.2.3
	Author: Amit Verma
	Author URI: http://amit.me/
	$kCmcp_incponc='mcp_incponc'; //include Pages on category pages
	$kCmcp_showponp='mcp_showponp'; //show posts on pages
	$kCmcp_showponp_arg='mcp_showponp_arg';//argument for title of posts to show on the Pages header=Posts&before=<h3>&after=</h3>
	//to make it compatible with WP3
	add_action('init', 'mcp_init');
	function mcp_init() {
	  		register_taxonomy_for_object_type('category', 'page');
	add_action('admin_menu', 'add_category_box_on_page');
	function add_category_box_on_page(){
			add_meta_box('categorydiv', __('Categories'), 'page_categories_meta_box', 'page', 'side', 'low');
	function page_categories_meta_box($post) {
	<ul id="category-tabs">
		<li class="tabs"><?php _e( 'All Categories' ); ?>
		<li class="hide-if-no-js"><?php _e( 'Most Used' ); ?>
	<div id="categories-pop" class="tabs-panel" style="display: none;">
		<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
	<?php $popular_ids = wp_popular_terms_checklist('category'); ?>
	<div id="categories-all" class="tabs-panel">
		<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
	<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
	<?php if ( current_user_can('manage_categories') ) : ?>
	<div id="category-adder" class="wp-hidden-children">
		<h4><?php _e( '+ Add New Category' ); ?></h4>
		<p id="category-add" class="wp-hidden-child">
		<label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
		<label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?>
		<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
	<?php	wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
		<span id="category-ajax-response"></span></p>
	//call a function just before the query runs to fetch posts to include THE PAGES on CATEGORY pages
	function change_post_type( $query ) {
		global $kCmcp_incponc;//if its a category page and user opt to display Pages on category pages
		if(is_category() && get_option($kCmcp_incponc)==1)
			$current_post_types = get_post_types();
			array_push($current_post_types, "page");
			$query->set( 'post_type', $current_post_types);
			return $query;
	add_filter('the_content', 'mcp_process_posts');
	function mcp_process_posts($content=''){
		global $kCmcp_showponp, $kCmcp_showponp_arg;
		if(is_page() && get_option($kCmcp_showponp)==1){
			$args = get_option($kCmcp_showponp_arg);
			$defaults = array('header' => '', 'before' => '', 'after' =>  '');
			$r = wp_parse_args($args, $defaults);
			extract( $r, EXTR_SKIP );
			if(strlen($before)==0 || strlen($after)==0){
			global $post;
			foreach(get_the_category() as $category) {
				return $content;
			$showposts = -1; // -1 shows all posts
			$do_not_show_stickies = 1; // 0 to show stickies
			   'category__in' => $cat,
			   'showposts' => $showposts,
			   'caller_get_posts' => $do_not_show_stickies
			$my_query = new WP_Query($args);
	        <?php if( $my_query->have_posts() ) : ?>
	        <?php $content.='<h2>'.$header.'</h2>'; ?>
			<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
				//$content.='<div class="entry right">';
				$content.='		'.$before.''.get_the_title().''.$after;
					<?php endwhile; ?>
		<?php endif; ?>
		return $content;

	this section is resposible for the output:
[code]<?php if( $my_query->have_posts() ) : ?> <?php $content.='<h2>'.$header.'</h2>'; ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php //$content.='<div class="entry right">'; $content.=' '.$before.''.get_the_title().''.$after; //$content.='</div>'; ?> <?php endwhile; ?> <?php endif; ?>
So I need to paste there some code that will output the date, author of the post and post content. According to this article: http://codex.wordpress.org/The_Loop_in_Action I must put there something like this:
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
	<div class="entry">
	<?php the_content('Read the rest of this entry »'); ?>

But if I do this, I get only a list of authors and dates thousand times shown on the page (i have only two posts). I continue my experiments. May be now somebody could help with the code.

Share this post

Link to post
Share on other sites

Please make your postings more concise.. its very hard to navigate this amount of code. What are your current issues? Maybe ask more pointed questions and start another thread?

Share this post

Link to post
Share on other sites

Made it through the function.php and page templates.

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