Articles of theme development

WordPress pulling in random page themes

I have a website that has multiple custom templates — a variety for pages and a couple for custom post types. However, WP is now screwing it all up. For instance: All of the pages that were setup to use the “Subpage – Standard” custom template have automatically changed to “Default” on the backend but […]

Displaying a custom post types custom taxonomy value?

I’ve got a custom post type with multiple custom taxonomies + metaboxes. I’ve used multiple approaches from the codex and other on line resources but none seem to work. I basically want to display the current posts taxonomy values below the title on each custom post’s page. This is what I have so far… In […]

Output richtext metabox value

I have rich text metabox.When I echo the out put it shows html tags.If I write <h1>Hi</h1> in editor metabox it ouput the same.My works so far <?php $valueeee2= get_post_meta($_GET[‘post’], ‘SMTH_METANAME_VALUE’ , true ) ; wp_editor( htmlspecialchars_decode($valueeee2), ‘mettaabox_ID_stylee’, $settings = array(‘textarea_name’=>’MyInputNAME’,) ); ?> To display $content=get_post_meta($post->ID, ‘SMTH_METANAME_VALUE’, true); echo $content;

Only the latest post shows up on post page?

disclaimer: this is my first foray into wordpress I’m creating a custom theme and in the single.php file, i have the main loop, however if i navigate to different posts, all that shows up is the latest post. I could go to the different permalinks, but the only post that shows up is the latest […]

Rewrite Question Mark in Post Template with URL Parameter for clean URLs

I use following code (Source) to change the single post template via url parameter: function sjc_add_query_vars($vars) { return array(‘template’) + $vars; } add_filter(‘query_vars’, ‘sjc_add_query_vars’); function sjc_template($template) { global $wp; if ($wp->query_vars[‘template’]==’basic’) { return dirname( __FILE__ ) . ‘/single-basic.php’; } else { return $template; } } add_filter(‘single_template’, ‘sjc_template’); The Code above works fine, so for example: […]

Never actually adding the action? Or do I have to call the action?

I have the following class that is instantiated in the function.php file. In the constructor I am setting up a activation and a deactivation hook for the theme. How ever neither seem to be called when I actually switch between this theme and say twenty fourteen and then back. As the echo statements are not […]

Let user to add input fields on theme option page

I’m creating a Theme Option page for my own wordpress theme and I’ve been trying to create something like this on my option page It means my user(admin) can add any number of input fields (in this image, they’re drop down elements) I need to add this feature as a inbuilt option page, so plugins […]

Custom meta box in custom post type not working

As a wordpress newbie I am having problems in adding custom meta box in my “slider” custom post type which I used in some old wp theme. I’m getting a warning: Warning: call_user_func() expects parameter 1 to be a valid callback, function ‘new_meta_box’ not found or invalid function name in… Here is my code: ///////////////////////////////////// […]

Show different website layout if no sidebar added

I have a question about website layout with and without wp widges in sidebar. Here is the code i have for my registered sidebar. <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(products) ) : endif; ?> And this is the code i have in functions.php if (function_exists(‘register_sidebar’)) { $opts = array( ‘name’ => ‘Products’, ‘before_widget’ => ‘<div […]

Pagination not working on custom post page

I have created custom post type called natural food In my page-natural-food.php <div class=”main container”> <div class=”content left”> <?php $type = ‘naturalfoods’; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args=array( ‘post_type’ => $type, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 2, ‘paged’=>$paged ); $my_query = null; $my_query = new WP_Query($args); if ( $my_query->have_posts()) : while ( $my_query->have_posts()) […]