Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
1,085
questions with no upvoted or accepted answers
5
votes
0
answers
478
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 ...
5
votes
3
answers
9k
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 ...
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
428
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
1
answer
2k
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 ...
4
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-...
3
votes
0
answers
169
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:
<...
3
votes
0
answers
77
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
1k
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 ...
3
votes
0
answers
355
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
1
answer
444
views
How do i define the location of a git push to WP Engine
Ive been using Gits version control system for local theme development on a Wordpress site. I decided to take advantage of WPEngine's git capabilities which has caused more frustration than not.
I ...
3
votes
2
answers
1k
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 ...
3
votes
2
answers
2k
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
243
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 ...
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 ...
2
votes
0
answers
38
views
Adding block style dependencies
I'm running into a problem where my block styles are being enqueued before my theme style. Because of this, the theme style is overriding my blocks and that is undesirable.
Is it possible to add style ...
2
votes
0
answers
43
views
Is there a block to print post link standalone in a block theme?
I know we can print post property (e.g. title or date) wrapped into the link to the post by using a block with the attribute "isLink":true i.e.
<!-- wp:post-title {"level":1, &...
2
votes
0
answers
55
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 ...
2
votes
0
answers
428
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
53
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
0
answers
778
views
Wordpress Block Theme: Customize meta viewport
I am building a custom Block theme and I need to have this meta viewport in my <head> :
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, ...
2
votes
1
answer
330
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
598
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 ...
2
votes
1
answer
88
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
0
answers
668
views
What is the correct way of getting parent styles from child theme?
I just started customising our company's theme. Thus i just started learning wordpress development
In wordpress original docs about child themes, it says:
If the parent theme loads its style using a ...
2
votes
1
answer
1k
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 ...
2
votes
0
answers
298
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
66
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 ...
2
votes
0
answers
729
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
75
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 ...
2
votes
1
answer
296
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 '...
2
votes
1
answer
68
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 ...
2
votes
1
answer
118
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 ...
2
votes
1
answer
537
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-&...
2
votes
1
answer
2k
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 ...
2
votes
1
answer
542
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
522
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 ...
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
507
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 ...
2
votes
0
answers
728
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( '...
2
votes
0
answers
50
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
824
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://...
2
votes
1
answer
1k
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 ...
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
216
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 (...
2
votes
1
answer
1k
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
20
views
Block editor layout not present in post editor
I have a WordPress block theme entirely built using the block editor, i.e. empty html template files. Since a recent update of WordPress, the post editor is not abiding to the width applied in the ...