Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
4,339
questions
0
votes
0
answers
9
views
enqueuing external and internal js and css in wordpress did not work with owl.js animate.css
<?php
function cadentic_files () {
wp_enqueue_script('cadentic_owl_carousel',get_theme_file_uri('js/owl.carousel.min.js'), array('jquery'), time(), true );
wp_enqueue_script('...
0
votes
1
answer
11
views
Adding star ratings to testimonials slider
So I've built a testimonials post type into my WordPress theme added it to a slider on the homepage but I'm getting confused when it comes to adding the rating given by the customers can anyone point ...
0
votes
1
answer
20
views
I don't think WordPress is loading jquery or bootstrap js
I'm building a WordPress theme and I've used the code from https://codeinhouse.com/how-to-create-custom-post-type-slider-in-wordpress-without-plugin/ to build my slider I've also used https://github....
0
votes
1
answer
17
views
WordPress navigation wont appear with wp_head
so im building a custom theme and ive got stuck on the navigation
if i use wp_head(); it loads bootstrap and my custom style sheet but not the navigation
if i use get_header(); it loads the navigation ...
0
votes
0
answers
33
views
get_the_terms() returning wrong results inside of loop
When I use get_the_terms() inside a loop, the whole thing behaves very strangely. Sometimes the terms are included twice or three times and sometimes a post inside of the loop returns only false.
I ...
0
votes
0
answers
12
views
How do you remove header sitewide from mobile only?
I'm having trouble hiding my header on mobile devices. My wordpress theme does not have an option to hide it, so I was looking at the theme's header.php file if there was anything I could add to it. ...
0
votes
0
answers
19
views
WordPress custom menu can't show 3. level submenu
I Use a custom walker from my menu in WordPress and my menu doesn't show all levels.
https://soulofcroatia.com/ ->One Day menu item.
This is my code in header.php
<?php
...
0
votes
1
answer
53
views
How do I get the trackback count of a post in wordpress without writing an SQL query?
How do I get the trackback count of a post in wordpress without writing an SQL query?
I tried searching Brave Search and I couldn't find anything helpful. To fetch the amount of comments a post has, ...
0
votes
1
answer
20
views
Post and page content not displaying in search results
I am using a content-search.php template part to output my search results. The post/page titles and links to those posts/pages are working correctly, but for some reason the the_content() function is ...
0
votes
0
answers
33
views
Adding google fonts to WordPress theme
I am trying to add google fonts to a custom WordPress theme. Therefore I tried to enqueue selected three font faces at once to make it fast loading. So, I use the below codes to register and enqueue ...
0
votes
1
answer
49
views
PHP File_exist() not working - Checking if File Exist in WordPress Theme Directory
I am trying to check if a certain archive file template exists in the WP theme directory. This is my code, I am not sure what I am missing here.
<?php
$file_name = '/archive.php';
$...
0
votes
0
answers
30
views
How to enqueue a script which is type module without using script_loader_tag filter?
I'm creating a theme and i want to upload it to envato. I have a javascript file that is type module and i can enqueue it and then use script_loader_tag filter to add type module to it by these lines.
...
0
votes
1
answer
28
views
Hide Heading if ACF Field is empty
I am trying to add a "Local FAQ" section to all the individual location pages on a site with literally thousands of individual location pages. I am doing this by using ACF field in the ...
0
votes
0
answers
21
views
Change the behaviour of a button
I'm using Flatesome theme and I have a use case that I need to refresh the page after closing the popup, I'm wondering if I can change the behavior of the close button in Lightbox Popup so instead of ...
0
votes
0
answers
39
views
WP_Query order posts by category
In a custom WP_Query I want to order posts by category. I mean that I want to show posts with term_id=1291 first and then show other posts.
when I use two WP_Query , I cant use pagination.
"...
0
votes
0
answers
18
views
Is there any way to store single.php wordpress file into a php variable
I am finding an way to store single.php file in a variable in wordpress file, I want to use preg_match_all to this file.
$regex = "~(<h([2-6]))(.*?>(.*)<\/h[2-6]>)~";
$...
0
votes
0
answers
13
views
Woocommerce Variable Product Dropdown for Custom Shop Template
I'm building out a custom shop template and I'm trying to achieve something like this.
Where the user can choose the product variation in the dropdown, choose quantity, and click add to cart without ...
0
votes
0
answers
37
views
custom post type query causing errors
Any idea what is wrong with this? It "works" but it runs the error_log bananas. It should be noted that this code excerpt is from the "404.php" file
Here's the code:
...
0
votes
1
answer
24
views
Dynamically switch file in get_template_directory_uri() | Function [closed]
I need to switch scheme color of my WordPress theme trough Redux option panel.
My plan is switch the CSS file trough get_template_directory_uri() | Function.
The scenario is:
Create 2 scheme color: ...
0
votes
0
answers
16
views
Configuring Xdebug with docker compose
I'm trying to configure a WordPress development environment with docker-compose and Xdebug but I can't get the debugger to work with a simple break point on info.php file after starting my debugging ...
0
votes
1
answer
16
views
How to get a random single category name in get_posts()?
How can I get a random category name one at a time?? The post may have multiple category instead of a single category. I just want to show a single category name in the post grid loop.
$...
0
votes
0
answers
16
views
woocommerce remove coupon link does not work
Woocommerce remove coupon link does not work in custom cart page:
Here is code my Code:
<div class="report-text-cntr-cart row mr-0 ml-0 <?php echo ( WC()->customer->...
0
votes
1
answer
18
views
Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
I installed latest XAMPP & extracted latest WordPress
to this path: C:\xampp\htdocs
I activated default theme: Active: Twenty Twenty
I created these:
1 Page called test: http://localhost:82/...
0
votes
0
answers
28
views
How can I add a field for featured image on backend of a custom Taxonomy?
I came accross this problem when trying to create a new wordpress Theme,
I want to add a custom term field for featured images on the backend of a custom taxonomy,
I have followed this tutorial and ...
1
vote
0
answers
16
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 ...
3
votes
0
answers
22
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 ...
0
votes
0
answers
14
views
Woocommerce AJAX filters option loading spiner - problem on mobile device
I've got quite weird problem. I built product filtering options, sometimes the server is slower so I wanted to add a loading spinner while you wait for the results. I only managed 50% because it works ...
0
votes
1
answer
18
views
Any way to change/add to the theme name dynamically?
I'm currently working on a site with coworkers and our way, since we have only one staging, is to have 4 times the theme. The master branch in git, and we got each our version of the theme with the ...
0
votes
0
answers
9
views
How to add wysiwyg editor in customize screen using customize_register
Welcome
I am developing a theme and I need to add wysiwyg editor to the customize screen using the “customize_register()” , I searched a lot here and on other sites about how to add it, and although ...
0
votes
0
answers
28
views
PHP inside echo HTML
I am a little bit confused about the following code:
i need to add span class="<?= $styles['core']; ?>"
<?php
if( ! defined( 'CP_VC_ACTIVE' ) ) {
echo '<li><span class=&...
0
votes
0
answers
10
views
Gallery functionality in custom theme
I'm new to creating my own theme and I barely scratched the surface of this topic so far. But my end goal would be to create a "gallery like" functionality.
Maybe there are some functions or ...
0
votes
1
answer
21
views
require_once not working in plugin wordpress
I'm creating a plugin and I have to add some custom controls through the plugin. Here is the code for the custom control defined in featured-types.php -
function ...
0
votes
1
answer
10
views
WordPress Animation Adjustments
I have a problem with my WordPress animations. https://cyals.com is the website Currently developing. I Use Elementor Page Builder to build my page. a man and a woman load with animations one by one ...
1
vote
1
answer
30
views
How to render a time-of-day string like '16:42' with a site's chosen time format?
I have a need to display a time-of-day value in a site's chosen time format.
For example I have 16:42:18 and want to display it as 4:42 PM if the time_format option is g:i A, or 16:42:18 if the ...
0
votes
0
answers
33
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, ...
0
votes
0
answers
8
views
Available widgets is not showing up?
I have added theme support in functions.php file.
add_theme_support('widgets');
And register the menu still no available default widget.
class Sidebars{
public function __construct(){
$...
0
votes
0
answers
20
views
Need help for some PHP code
I've already set all the fields in my theme settings but I want that carousel-items class repeats whenever I add slides to it, and [0] changes to [1],[2],...
<div class="carousel-items"&...
0
votes
0
answers
8
views
theme directory fallback image outputs url and not the image
I am adding a custom post thumbnail column to the user admin table in WordPress.
I want to retrieve a fallback image from my theme image directory if no post thumbnail has been created. I don't want ...
0
votes
0
answers
14
views
How to register dynamic settings in WordPress Customizer?
I have been experimenting with the Customizer JS API to create Panels, Sections, Settings and Controls in the Customizer. Till now, I have been using the PHP API but decided to try the JS API for the ...
1
vote
1
answer
58
views
Should action callbacks start with a verb?
class Singleton {
public function __construct() {
// Case #1
add_action( 'woocommerce_before_shop_loop_item', [ $this, 'open_product_wrapper' ], 10 );
add_action( '...
0
votes
0
answers
25
views
need to find duplicated meta value in custom filed and view the posts that have the same value
I used this code but return blank
<?php
global $post;
global $wpdb;
$duplicate_titles = $wpdb->get_results("
SELECT meta_value FROM $wpdb->postmeta
INNER JOIN $wpdb->posts
...
0
votes
0
answers
17
views
How to add audio files to audio player in WordPress custom theme?
I want to add the native html5 audio player to the header of my custom WordPress theme but I want to be able to upload and change the audio files from wordpress admin.
No idea which direction I should ...
0
votes
0
answers
12
views
How do you get the current post taxonomy so I can get the current post taxonomy? into a variable to THEN loop through all post with that taxonomy.,
Is there a function that I could use to pull the current taxonomy (each post should ONLY have 1 taxonomy) from the current post so then I can store it in a variable to use it in a loop to loop through ...
0
votes
1
answer
28
views
Getting white screen of death on category pages because of body_class() function
Category pages "example.com/categeories/blah" were working fine and then suddenly started showing white screens.
Debug showed no output. No errors in apache logs either. So I started ...
0
votes
0
answers
132
views
Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
My WordPress site is using a custom theme written by a third-party. I am getting the white screen error on my pages saying There has been a critical error on this website.
In attempt to diagnose the ...
0
votes
1
answer
24
views
Trying to link to a php template file but its blank
From this Stack Overflow qestion It shows a bunch of ways to make page templates. But I don't want to use a page template that uses Gutenberg.
Is there another way to make a PHP file like a tos.php, ...
1
vote
0
answers
35
views
How to check if a WordPress core block is active in sidebar
I have a widget area and I want to enqueue a stylesheet only if a core block is active in it. I tried the following code:
// if has audio block.
if (has_block('audio')) {
wp_enqueue_style('audio-...
-1
votes
1
answer
81
views
can't add EVENT LISTENER to a element
I'm trying to add a click eventListener to a element in homepage, it doesn't work. the event is not even added to the element.
the above picture shows the html of the homepage. where I wanted to add ...
0
votes
0
answers
11
views
Elementor Sidebar not loading when PRO elements plugin is active
I am currently running into an issue on my site whereby the elementor plugin will not load in the editor view while the PRO elements plugin is installed
The issue is that the theme and pre-built site ...
0
votes
0
answers
16
views
Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
This is my first attempt at creating a theme for WordPress, I seem to have things working well for the classic editor, however, I'm having issues with the Gutenberg block editor. I'm trying to get it ...