Questions tagged [theme-development]

Themes create the public (front-end) interface for a WordPress site.

1,080 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
1 answer
143 views

Can I create customizer setting that can handle plugin shortcode?

Can I create a customizer setting which will handle a shortcode from a plugin? Do I violate and rules or guidelines in WordPress theme development? If it's possible what is the best way to sanitize ...
4 votes
1 answer
267 views

Problems with Layout inherit in theme.json

I have in the theme.json of my FSE theme the following lines in the code: "version": 2, "settings": { "layout": { "contentSize": "840px&...
4 votes
0 answers
241 views

How to support Lazy Loading Assets in a WordPress Theme?

I'm using the create-block module provided in Gutenberg Core to build my custom blocks within a plugin. It works great, but I'm struggling to figure out how to conditionally load the assets on the ...
  • 95
4 votes
1 answer
1k views

Add custom buttons with custom actions in Edit Post screen in WordPress?

I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...
  • 41
4 votes
3 answers
8k views

Get category slug and display it on a query_post

I just read "How to create option page for wordpress theme" in wp.tutsplus.com - I have a problem with getting categories . there is two parts to my question - Part A - Get category slug and ...
  • 41
3 votes
0 answers
50 views

Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?

Usually, I can replace the template files and PHP codes of any parent classic theme with child themes. Since block-based theme templates rely on HTML, how can I replace parent block-based theme files ...
3 votes
0 answers
796 views

Changing order title and featured image in blog post (Astra theme)

The HTML of a post type, I want to swap the position of the title and the thumbnail. I noticed that the title and thumbnail are inside a <header> tag. So I went looking which template file has ...
  • 131
3 votes
0 answers
321 views

WordPress Customizer Control with React

I am just doing a demo on the WordPress customizer API to edit the header with custom controls. I have designed a custom control by extending WP_Customize_Control and Jquery to refresh/postMessage ...
3 votes
2 answers
925 views

Cache Busting using htaccess Rewrite rule?

I am trying to follow this tutorial that says i can make a server to send a file like style.css if the requested file is style.15458888.css with a rewrite rule to be put inside the htaccess file. ...
3 votes
0 answers
1k views

Add a theme via symlink

I want to keep my theme files separate from my WordPress install. I’ve done that by symlinking the theme directory to the WordPress wp-content/themes directory. Unfortunately, the theme won’t show up ...
  • 221
3 votes
2 answers
1k views

What is better way to use Bootstrap inside admin panel?

I need to use Bootstrap CSS for better UI in wp-admin but if I enqueue the bootstrap.css, it's affecting the admin default UI by changing background colors, etc. How can I use bootstrap.css inside wp-...
3 votes
1 answer
235 views

Is it possible to display the admin bar while in the Theme Customizer?

I've been using Debug Bar + Kint Debugger for debugging. Presently I'm working on a custom theme where I'm trying to hook some code into customize_save_after. The code doesn't appear to be running ...
  • 49
3 votes
1 answer
3k views

"Cheatin’ uh?" error message on multple theme directories

In my wp-config.php I've added another theme directory; register_theme_directory( dirname( __FILE__ ) . '\..\themes' );. I'm not sure if this is the correct place to add it. When I then try to ...
  • 423
3 votes
1 answer
2k views

How to use Iris color picker on front-end?

I am trying to use new Iris color picker on the front-end. I succeed in using it on back-end: while using it on theme options I just enqueued the color picker like this … wp_enqueue_script( 'wp-color-...
2 votes
0 answers
115 views

Is there a way to prevent wp_head from outputting self-closing tags?

I'm a beginner in WP development, so maybe I'm missing something obvious. Is there a way to prevent wp_head from outputting self-closing tags? Here are two example lines taken from my website: <...
  • 21
2 votes
0 answers
66 views

Gutenberg text field validation

I have been searching for ages but can't seem to find an exact method on how to perform text input validation when building custom blocks. I saw that for TextControl inputs you can just pass the ...
2 votes
0 answers
46 views

Hide categories that are not used in the post type

I have a situation where I need to display categories on the Archive Page of CPTs, but if the category is not used anywhere in the CPT, it needs to be excluded from the list. For example, I have a CPT ...
2 votes
1 answer
198 views

WordPress Gutenberg Theme: Structure, Hierarchy and Custom Templates

I'm starting to develop a WordPress theme using Gutenberg. I've never worked with Gutenberg before, but since the support for Classic Editor might possibly end next year, I want to use it now since I ...
2 votes
0 answers
560 views

Wordpress 5.8 update problem custom theme styles are overridden by core styles common.min.css

After the automatic update to wordpress 5.8 today one of my custom themes displayed wrong styling in the frontend for custom webfonts, colors, font-sizes and other styles. After a quick check in the ...
  • 244
2 votes
1 answer
60 views

why <?php wp_title(); ?> adds '»' symbol?

on last Wordpress when I wrote <?php wp_title(); ?> appear » symbol before the name of the page.. On my functions.php I wrote add_theme_support( 'title-tag' ); Thanks
2 votes
1 answer
759 views

How can I get full attachment url from wp_get_attachment_metadata?

I want to get all sizes of an attachment. I can use wp_get_attachment_metadata to do this. But it only return filenames, not file urls. How can I do this? This is a workaround, but doesn't take ...
  • 394
2 votes
0 answers
224 views

Limit users by custom taxonomy and user roles

This is not duplicated post! I working on the custom theme and have 2 taxonomies: bezirk and ortsgruppen. bezirk acts like main group and ortsgruppen is the sub group under bezirk. I need to asign ...
2 votes
0 answers
65 views

Gutenberg Reusable Block as part of WordPress Theme page

I'm using WordPress "Twenty Nineteen" (child) theme. What I'm trying to achieve is to include one of my previously created Gutenberg Reusable Blocks as part of theme's index.php file. The reason for ...
  • 21
2 votes
0 answers
648 views

Getting yoast title for custom taxonomy

I have created a theme template for a custom taxonomy. The HTML title tag has the yoast title that I set when editing the taxonomy. I want to also make this the title of the page. I cant seem to ...
2 votes
1 answer
56 views

How to hook CSS file according to theme selection in the customizer section

I have added a new area in the Customizer section which allows a user to choose whichever theme colors they want: But I don't know how to activate/add CSS files according to the selection. i.e. add ...
  • 121
2 votes
1 answer
271 views

Why is $GLOBALS['content_width'] needed if site is responsive?

Help to understand its practical usefulness today. I had written it in my theme, but practically it does not use — all embedded content are responsive and don't use value of this variable. Maybe '...
user avatar
2 votes
1 answer
65 views

WordPress default theme css units

Is there a specific rule the default WordPress themes follow for CSS units? I see em's on some font sizes and rems on others and px on certain places. Referred the following links but I couldn't ...
  • 65
2 votes
1 answer
110 views

Convert a complex webpage into WP theme

I am new to the whole WP theme development, but I have undertaken a couple of courses and watched a few tutorials on how to convert HTML/PHP pages into a wordpress theme. However, every single ...
  • 133
2 votes
1 answer
490 views

How to make thumbnail image fit into a div where image dimentions are completely different?

I defined a div which is 200px * 200px for my thumbnails using the code below in my index.php file: <ul> <?php $my_query = new WP_Query('showposts=10&cat=3'); while ($my_query-&...
  • 21
2 votes
1 answer
1k views

front-page.php is not Listing in Static Front Page List

I have a in my theme directory and I would like to set the WP to be static based on page. I didnt create any pages so far because my assumption was the must be listed as a page in the front page ...
  • 493
2 votes
1 answer
521 views

WP theme with Backbone

What would be the best way to insure that a Backbone WP theme cooperates with standard shortcodes and other WP plugins that include script and style tags in header and footer. I know Backbone plays ...
2 votes
0 answers
419 views

Change file name from wp_generate_attachment_metadata

I'm pretty new and just have a hang on how wordpress data flows internal. I am confronted with applying a b/w filter on upload. no problem. I found the wp_generate_attachment_metadata filter and ...
  • 21
2 votes
1 answer
27 views

How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?

I currently have a theme with OptionTree installed. It is used to create a list of locations which are then visible in a dropdown in the header of the page. The display code with OptionTree looks like ...
2 votes
1 answer
493 views

Adding default pagination to wordpress loop

I am trying to add default pagination to my Wordpress loop but am unsure where to begin, most guides explain how to create custom numbered pagination. I simply need the default wp pagination. (newer ...
  • 248
2 votes
0 answers
696 views

unzip a folder on specific location and delete the zip file

After the lots of search. I am deciding to post my question here. Basically i want to upload a zip file in my wordpress site from my admin panel. And also extract this file to specific location with ...
2 votes
0 answers
1k views

Overwrite Parent Theme add_image_size in Child Theme

I'm using a child theme of a parent theme. Now on my parent theme, theveloper adds some custom image sizes like this - if ( function_exists( 'add_image_size' ) ) { add_image_size( '...
  • 904
2 votes
0 answers
49 views

Theme unit test data Foreign fonts come in garbled on my machine

Having just tried out the Theme Unit Test Data from the WordPress.org Codex, I noticed that some of the body text doesn't import properly on my set up which is a Mac running Mavericks. The effect is ...
2 votes
1 answer
707 views

Remove parent from custom post type

I've created a new custom post type with WordPress. However, the slug adds the post to a parent, like so: http://example.com/UNNCESSARY-PARENT/post-title However, I'd like it to create: http://...
  • 853
2 votes
1 answer
990 views

Adding wp_enqueue_media(); causes problem

I want to add the media uploader in the theme options page. If I add following code in the options page, the media uploader works fine there, but it creates problem in the standard posts featured ...
  • 61
2 votes
0 answers
84 views

gallery option is not available in media upload box in costum theme option page

I am creating a theme in which I have to create a sponsor's image gallery on the admin panel in theme option page. It's a slide show on the front panel. For this, I followed a tutorial to create a ...
2 votes
2 answers
209 views

Page as a child of a Custom Post Type

I have a custom post type called "Professions", it contains different professions and info about them. To show them I simply use a content-profession.php -file. The thing is that I need subpages (...
  • 41
2 votes
1 answer
977 views

Best choice of options/settings framework for plugin/theme development

My question is what is the best options/settings framework out there now to safely build custom plugin/theme upon? I found the similar question here, but it was asked 7 years ago and definitely, ...
2 votes
1 answer
2k views

how to implement wp_is_mobile on themes?

I just read the wp_is_mobile function reference and I have some questions. As you can read, there is a line explanation in bold text: It also should not be used for themes. I excactly don't know what ...
1 vote
0 answers
12 views

WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?

You know WordPress is adding pagination for all pages not only for posts page/blog page. For example www.mysite.com, I'm getting URLs like www.mysite.com/page/15, etc. Here, www.mysite.com has a ...
1 vote
0 answers
59 views

How do I add new layout width options in Wordpress editor?

How can I add new custom widths to the block alignment menu? I have set the two inbuilt ones in my theme.json, but how do I add more? Eg. narrowSize etc. { "settings": { "...
1 vote
0 answers
13 views

Custom background not showing

I'm writing my own theme and i have a problem with body background My code in functions.php if (! function_exists('anime_quotes_setup')){ function anime_quotes_setup(){ add_theme_support( 'custom-...
  • 11
1 vote
0 answers
20 views

Correct way to make a custom block theme responsive

I am trying to make a custom responsive theme using the new Block / FSE approach however I dont think the method Im using is correct. This is the current design: This is the view in block editor: In ...
  • 111
1 vote
0 answers
25 views

Can you programme the selected page template to display block patterns automatically?

Ideally, if I select a template called "3 columns", the block patterns layout I've premade would automatically load into place. I understand you can predetermine regular posts block pattern ...
1 vote
0 answers
27 views

Gutenberg theme development: how to add "headers" option under styles > colors > elements?

I'm not sure if this is even possible as I'm still learning about Gutenberg full site editing theme development. I've done my best to research this and read over the documentation before asking this ...
1 vote
0 answers
23 views

Not able to select width of blocks inside of cover block

I am using a blank theme with the theme.json for gutenberg blocks. When I create a cover block and select any block inside of my cover block it doesn't give me the option the select the width ...

1
2 3 4 5
22