Articles of theme development

Template tags to display custom post type posts in category template?

I am developing a custom theme with custom post types involved. Custom post types have been defined via plugin ‘Pods’ (http://pods.io). When writing a category.php, I realized, that the standard loop does not retrieve custom post types (CPT) posts which belong to a certain category. Is that right? If not, are there any template tags […]

Full width featured thumbnail

How to make post thumbnail full width above sidebar and content? I am using bootstrap for a theme and have a single template named single-thumbnail-featured.php. On this post I need the thumbnail to be full width and the rest of the content and sidebar to be under it. I have the following code to display […]

changing Specific section background image in wordpress

How do I change specific section background image in wordpress? I have a background image set via CSS: .section3 { background: url(bg.jpg) no repeat; } Say I want to change this image later via the WordPress dashboard. How would I do this? I want to add functionality so that user can change the image in […]

using part of a theme in another theme

So I have a divi theme I have been using to build a site… only thing is I wanted a portfolio section that was quite specific so I ended up using the wanchai wordpress template. I have both templates but want to merge the portfolio functionality from wanchai to divi theme… can anyone help on […]

Unable to change the priority with 'remove_action' and 'add_action' in child theme

I am using an Woo theme. In the parent theme, there is this function: function woothemes_wp_head() { do_action( ‘woothemes_wp_head_before’ ); if ( function_exists( ‘woo_output_alt_stylesheet’ ) ) woo_output_alt_stylesheet(); if ( function_exists( ‘woo_output_custom_favicon’ ) ) woo_output_custom_favicon(); if ( function_exists( ‘woo_head_css’ ) ) woo_head_css(); if ( function_exists( ‘woo_shortcode_stylesheet’ ) ) woo_shortcode_stylesheet(); if ( function_exists( ‘woo_output_custom_css’ ) ) woo_output_custom_css(); […]

StoreFront WordPress theme: How can i create a new Home page with Custom design same as template

I am getting too frustrated while creating new home page using template in Storefront theme. https://wordpress.org/themes/storefront/. With the help of this https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/ i tried bt not getting success.. anyone can tell me how can i do this without plug-in.. I want to change home page , and want to show my custom template home page. […]

LESS not working in WordPress

How to run the CSS preprocessor (LESS) in WordPress? I’m trying to apply LESS in my child theme. I create variable.less and place it in the child theme folder css/less/variable.less and I call this .less in my style.css like this @import “variable.less”. LESS is not working, I tried to call the js file for less […]

pre_get_comments or the_content filter

What is the best practice to show social icons always on all the posts and pages. Already I am firing pre_get_comments in my functions.php to show a sidebar between the post content and the comments. Also I added the code after the_content() of page.php… The Question: How can I choose the propper Hook? Fire pre_get_comments […]

Passing variable in hooks and filter

I was trying to pass variables in filtes. This works perfectly for me. class my_class { function my_class() { add_filter(‘wp_list_categories’, array(&$this,’cat_count_span’)); } function cat_count_span($links) { $links = str_replace(‘</a> (‘, ‘</a> <span>’, $links); $links = str_replace(‘)’, ‘</span>’, $links); return $links; } } new my_class(); But now I want to execute the filter based on theme options […]

Translate a child theme with pure PHP and gettext

I’m trying to translate a child theme of a parent theme that has all msgstr empty. Therefore, I’ve created the file de_DE.mo using the “WordPress i18n tools” recommended in the docs together with msgfmt. I put the file into my child theme directory’s subfolder languages/child. To tell WordPress about it, I added this to my […]