Articles of theme development

If user is logged in and has a role echo statement

I currently have a dive set up which I would like to display different bits of information when the user is logged in and has a specific role. I have three roles ‘administrator’ ‘adoption-agency’ and ‘shop-manager’ which I would like to display a link to the admin area. Then I have a role named ‘customer’ […]

How to Create Custom HTML Tag on Editor in `Text(HTML)` mode

Can you please let me know how I can add a custom Tag button into WP Editor in Text(HTML) mode like what I would like to insert into the Post is something like <hr class=”dark-line-2″ /> every time that user pushed on hr button

Shortcodes do not work in own template

I have a big problem rendering shortcodes in my template I designed for my Tennis Club which works fine. However, now I wanted to integrate the standard WordPress Gallery, which is implemented by a shortcode but the shortcode is not being displayed as a normal Gallery, it is displayed as a text without any images. […]

How to store a number (coming from cookie) into query vars for later usage in other filters?

I have a small HTML5 game playable (as “canvas”) at different social networks, which sets an HTTP cookie. When a player comes to my WordPress site (acting as help and support website for the game), I can fetch her id from the cookie (and verify it wasn’t faked – by calculating hash and fetching from […]

Wp_query with 2 meta keys and array of meta values

Hi in my post_type=shop i have 2 meta keys and array of values Custom fields Name Values cu_status pending,processing,completed cu_date 12-Jan-2016 , 13-Jan-2016, …… any date in the same format date(“d-M-Y”) Now i need to loop through all posts with cu_status =pending,processing and cu_date is between 12-Jan-2016 to 13-Apr-2016 What will the query ? Iam […]

Converting a static HTML template into a WP theme – How do I specify page content?

I’ve been creating and selling static HTML templates for too long now, so I decided to convert one of my single page templates into a WP theme to sell on one of the marketplaces, however I faced a big misunderstanding of what the standard theme package should come with. I’ve looked through dozens of tutorials […]

jQuery accordion menu

So I have just started developing a theme with _s (underscores) as a basis. For three days straight (almost) I have been trying to make an accordion menu sort of like this: Example: https://codyhouse.co/demo/multi-level-accordion-menu/animated.html I know I have to make use of jQuery, but I have never used jQuery before and I do not know […]

WordPress creating images if uploaded image is greater than 960px on one side?

I’m creating a new theme and have modified the media settings. From the Settings > Media page, all sizes are marked as 0x0 so they will not be produced. I am creating only 1 custom thumbnail in my functions.php file. In total I should be expecting only 2 images uploaded to WordPress (the original file […]

Custom Post Type – after disable 'Add New', I can't edit and delete post

I need to disable ‘Add New’ button for my CPT, but when I add: ‘capabilities’ => array( ‘create_posts’ => false, ‘edit_posts’ => true, ‘edit_post’ => true, ‘delete_post’ => true, ), I can only VIEW this post (I can’t edit and delete it) – why?

how to get title to custom tags page

how to get title to custom tags page ? & how to make if condition like to my taxonamy if ( is_page() ) { the_title(); } elseif ( is_tag() ) { single_tag_title(); } tax: add_action( ‘init’, ‘create_mtags_taxonomy’ ); function create_mtags_taxonomy() { $labels = array( ‘name’ => ‘More Tags’, ‘singular_name’ => ‘More Tags’, ‘menu_name’ => ‘More […]