Link to home
Start Free TrialLog in
Avatar of axessJosh
axessJosh

asked on

add meta box to select category to select on custom blog page in wordpress

I have created a custom template page in wordpress to display by category type.  I currently create a page for each category i'd like to display in a custom loop.  I'd like to make this a bit more functional for the user allowing them to select which categories display on the page through a custom meta box.

I've been doing some research about adding custom meta boxes to wordpress but want to make sure I'm on the right track.  Is there an easier way to get this accomplished?
Avatar of Ovid Burke
Ovid Burke
Flag of Saint Vincent and the Grenadines image

It might be useful to see your custom template to understand what is does and how. How do you currently select what category is displayed on a 'page'?
Avatar of axessJosh
axessJosh

ASKER

I've used the following code below.

 <?php

		global $post;

		$args = array( 'numberposts' => 35, 'category_name' => 'physicians');

		$myposts = get_posts( $args );

		foreach( $myposts as $post ) :	setup_postdata($post); ?>
        	<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

        <?php endforeach; ?>

Open in new window


What i'd like to do is be able to add a meta box in the admin edit screen allowing the user to choose which categories to display on these pages.  This would enable the user to define specific posts in a category to display on this page, and disregard the unselected categories.

we used a custom template by elegant themes at one point that allowed for this but I can't seem to figure how to add this functionality native to wordpress.
ASKER CERTIFIED SOLUTION
Avatar of Ovid Burke
Ovid Burke
Flag of Saint Vincent and the Grenadines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial