Questions tagged [theme-development]

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

810 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
2answers
2k views

Need help setting default setting value for radio button in theme customizer

I need help figuring out how the radio button saves it's value in the theme settings. In my theme I added Radio buttons in the theme customizer. So far they are working great. Although I have one ...
5
votes
1answer
109 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
1answer
2k views

get_attached_media() returns empty array if media file already used by another post

I wish to retrieve the different PDF and ZIP files attached to a single post and display them in a specific section, outside the content, using the WP function get_attached_media(). While my code ...
3
votes
1answer
196 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
3answers
3k 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 ...
3
votes
1answer
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
0answers
35 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
1answer
36 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
0answers
39 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
1answer
247 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
1answer
291 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
1answer
26 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
1answer
51 views

Change setting name in Customizer and keep the data

I created a theme while back when I was new to Customizer API and for some weird reasons I named theme settings as: $wp_customize->add_setting('thefunk_theme_options[header_color] Instead of just ...
2
votes
2answers
2k views

Widgets panel not displaying in the Theme Customizer

I am using the Theme Customizer to let users customize how their website looks. I noticed on the Twenty Fifteen theme there is a panel for Widgets. I have seen this on quite a few other themes too, ...
2
votes
1answer
139 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
0answers
629 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
0answers
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
1answer
796 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 ...
2
votes
1answer
1k views

Custom HTML structure in wp_list_categories

I am trying to accomplish an Ajax navigation for the categories and for that I need the code to look something like: <ul> <li data-level="1">Parent Category</li> <li data-...
2
votes
0answers
47 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
1answer
378 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
1answer
875 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
0answers
81 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
2answers
191 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
1answer
1k 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 ...
2
votes
1answer
1k 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-...
1
vote
0answers
22 views

Custom Nav Walker Trouble

I got a snippet for a custom nav walker online and it works fine for the main menu items. I can't figure out how to get it to work for the sub-menu items. This is what i'm trying to achieve: <ul ...
1
vote
0answers
42 views

Warning: A non-numeric value encountered in theme functions.php

Warning: A non-numeric value encountered in functions.php I am using php 7.1.31. I am using Linux Centos Server. I have also tried to type casting. but not worked. When I have changed php version to ...
1
vote
0answers
19 views

How can I ping update-core.php with a script?

I have the paid Divi theme on many websites on a cPanel powered server. I use WP-CLI in a bash script to update all the plugins and themes. But Divi will never update because it only reveals an ...
1
vote
1answer
31 views

Theme Development: Starter Content after hook

I'm making a Wordpress theme that generate placeholder menus using the theme support "starter content". I read the documentation and is very vague: https://make.wordpress.org/core/2016/11/30/starter-...
1
vote
2answers
41 views

Add dynamic links in WordPress custom theme

I want to implement a system to insert custom links in my wordpress custom theme. I don't want to hardcode these links inside my theme. These links are for the socials or partners website. So they ...
1
vote
0answers
17 views

Bootstrap card columns change images size

I have a bootstrao masonry grid made using the card columns technique. The images that will be part of the grid are all of the same size and this will not give the desired masonry like effect when the ...
1
vote
1answer
18 views

Default Permalink Type to Postname

I need my theme to default Permalink Type to Postname. Upon activation, my theme is executing the following code: //change permalinks to /%postname%/ global $wp_rewrite; //Write the rule ...
1
vote
0answers
30 views

How can I use $wp_query->tax_query as tax_query parameter for a new WP_Query instatiation?

I am trying to use $wp_query->tax_query right out of the box as tax_query parameter, however I cannot work this out. The parameters for my new WP_Query is actually the same as the default query of the ...
1
vote
0answers
54 views

Custom form in theme template displaying internal server error upon submission

I have a custom form in WordPress theme template but it is displaying internal server error upon submission. There is no error in error.log file regarding this submission. I am hosting my website on ...
1
vote
1answer
19 views

Storing the contents from txt file into The_Contents"

Currently I am trying to fetch data from an external page, which I have stored via a custom field and store it into the top portion of my WordPress the_content when the post is saved. The steps are ...
1
vote
0answers
21 views

Underscores Theme Unit Testing - Catching Untitled Posts

Wordpress 5.0.3 | Underscores Theme I'm unit testing a theme I based on underscores using the wptest.io xml. Underscores does not gracefully catch untitled posts. There is no title in either ...
1
vote
1answer
12 views

WordPress menu link doesn't work properly

I am developing custom site. The header links work on home-page but when I go inside shop then the home-link becomes siteurl/shop how to solve this? <div id="content" class="site-content"> &...
1
vote
0answers
106 views

How do you replace content generated by custom fields with custom blocks in Block Editor?

I am wanting to support the new Block Editor for a theme that I made for a client. However, one of the page types has part of the theme that is displayed depending on whether custom fields are set ...
1
vote
0answers
14 views

How to display all subpages and short by year

How can I display all child-pages and short by year in Wordpress For example: all subpages in 2016, 2017, 2018: • 2018: ----- Subpage A ----- Subpage B ----- Subpage C • 2017: ----- ...
1
vote
1answer
115 views

Adding custom class to get_avatar() image doesn't work

Instead of outputting <img alt="" src="#" srcset="#" class="avatar avatar-60 photo" height="60" width="60"> I want to add custom class which looks like <img alt="" src="#" srcset="#" class=...
1
vote
1answer
49 views

How to add styles set by user in the customizer

I want my theme to be very customizable, and so far i have provided the possibility to change text and link colors to the body, plus the background color which comes by default (I'm using the ...
1
vote
0answers
91 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 ...
1
vote
0answers
18 views

WP_Comment_Query - Get comments and answers separately

I was developing a theme and this time I chose to use the bootstrap4, I found some difficulties in the way but I managed to solve them and the result was satisfactory, however creating my comments.php ...
1
vote
0answers
285 views

populate form fields in a loop with ajax

The first row only works in my row. <?PHP for ($i = 1; $i <= 20; $i++){ ?> <div id="lines" class="row"> <div class="col-sm-1" style="text-align:left;...
1
vote
1answer
43 views

Error in custom php function doesn't exist

I was able to successfully set the default page template for a new page, when there is not yet a defined template to be member_home_page.php. This works perfectly on my local environment but when I ...
1
vote
0answers
152 views

Customizer: active_callback and sanitize_callback incompatibility?

Below are a few Customizer controls I have for my site logo - Display Logo, Logo File and Logo Size. As you can see, I'm using an active_callback so that when the display_logo checkbox is unchecked, ...
1
vote
1answer
188 views

Two queries on the same page with pagination

I’m trying to put two queries on the same page with pagination. But the pagination of one interferes in the other. How can I do this with two independent pagination <div class="row list-group"> ...
1
vote
0answers
188 views

excerpt() shows different result between remote and localhost(development environment)

Something strange when I am developing my own theme. Not sure what have I changed recently, but the the_excerpt() or get_the_excerpt() started to show full text on my localhost dev environment, while ...
1
vote
0answers
37 views

Disabling Customizer Selective Refresh shortcut icons for selected controls

Sometimes, on using the selective refresh feature, the shortcut looks little meaningless when an element is sort of removed from the view. For example, if I remove the custom logo and replace it ...