Articles of theme development

Reusable and site-wide content that can be used in a theme

Goal: To define content (phone number, address etc) in the admin area that can be used (called upon) in a theme. Context: I am making a theme for a multi-site where every site will look the same, but have different content. The user should be able to easily add basic information in the admin area, […]

why can't i add front.css to my frontpage.php

My function in functions.php function adding_front_style(){ if(is_front_page()){ wp_enqueue_style(‘front’,get_template_directory_uri().’/css/front.css’); }else{ //some code } } add_action(‘init’,’adding_front_style’); My front-page.php <?php get_header(); ?> <div class = “search”> <?php get_search_form() ?> </div> My front.css .search{ background-color: blue; }

How to customize this theme?

I am working on the following theme. https://wordpress.org/themes/ultra/ Does anybody know how can I remove the margin between widgets in this theme? How can I move the menu bar to a new line?

Same comments on all posts

I am working on a self-made theme and I have an issue where all of the comments are showing up on all the posts, instead of each post only showing their own comments. I am using this code to display comments: <?php if (have_posts()): ?> <?php while (have_posts()): ?> <?php the_post(); ?> // The title, […]

WordPress Customizer Default Image

I’m trying to set a default image to a Customizer image with the code below but image does not display. <img src=”<?php echo get_theme_mod( ‘header_image’ , ‘<?php get_template_directory_uri(); ?>/images/default-image.jpg’ ); ?>”> Am I missing something?

Check if we're viewing an event

I need to know how to check if the user is looking at an event or the list of events from the plugin The Events Calendar on my custom theme’s page.php. One solution I thought of was to grab the url. mysite.com/events shows the list of events, and mysite.com/event/theevent shows a specific event. I thought […]

Multiple editable areas

I am new to WordPress development and I am editing an existing theme. Basically, I created a custom template for Pages. I learnt that the editable content of the template is defined by the the_content() function. The problem is that I want to have more areas for the user to add content. Is that possible? […]

Removing “Powered by” footer using child theme PHP

I’d like to remove the “Powered by WordPress” custom link in the footer. I want to do this using action hooks/filters in the child theme‘s function.php file. I don’t want to use CSS (which just hides it), edit the original theme file (which will get overriden when the theme updates), or copy the footer.php file […]

Changing the Organize Series Listing Pages

I’m using the Organize Series plugin on my WordPress site. This plugin adds a custom taxonomy type named “series” that allows you to group posts together. This plugin includes a custom listing page at URLs that look like the following http://alanstorm.com/series/[series-name-here]/ I’d like to customize the HTML produced by these pages — but I’m a […]

Extending custom shortcode to also be called directly from theme PHP pages

I created the following shortcode which works well in returning the featured image of any given post I am on with a size… function mfeaturedimage( $atts ) { $a = shortcode_atts( array( ‘size’ => ‘medium’, ), $atts ); return the_post_thumbnail(“{$a[‘size’]}”); } add_shortcode( ‘feature’, ‘mfeaturedimage’ ); …But how can I evolve this to “also” be called […]