Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
4,353
questions
1
vote
0
answers
15
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 ...
0
votes
1
answer
19
views
Seperate plugin and theme files
I am in desperate need of help, regarding the following issue:
I need to establish an API Connection to Salesforce, so that a user can search and retrieve certain data out of Salesforce.
I thought, ...
0
votes
0
answers
7
views
Xamp installed local wordpress not allowing to publish or install plugin
I installed wordpress locally with xamp on my pc (Macbook pro Apple silicon 2021), yesterday I could normaly install a plugin (starter template) but today if I try to install a plugin it says at first ...
0
votes
1
answer
12
views
How to Enable Ascending or Descending In WordPress Default Built-in Loop
Can someone please let me know how we can add Order functionality to WordPress Built-in Loop?
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
// Post Content ...
0
votes
1
answer
19
views
Wordpress get_media_embedded
test text
<div class="video">
<?php
$media = get_media_embedded_in_content( apply_filters( 'the_content', get_the_content() ));
print_r($media);
...
0
votes
1
answer
18
views
Can I make a Customizer dropdown-pages list include private pages?
I'm using the following code to add a field to the Customizer where the user can select a page from the available pages on the site:
$wp_customize->add_control( 'resources_page', array(
'type' =...
2
votes
0
answers
34
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
32
views
What VSCode extensions are there for working with block themes? [closed]
I recently took another dive into Wordpress block themes by looking at the TwentyTwentyTwo theme. I'm noticing that all templating seems to take place either in PHP strings or HTML files chalked full ...
0
votes
1
answer
32
views
Wordpress 6.x / PHP 8.x deprecated warnings in development environment
The problem:
I want to run Wordpress 6.x with PHP 8.x in development mode - meaning define('WP_DEBUG', true); but Wordpress 6.x partial support for PHP 8.x throws a lot of deprecated warnings which do ...
1
vote
1
answer
36
views
What is the "correct" way to add hooks or similar PHP behavior to a blocktheme?
I'm building a new site and I wanted to build my theme from scratch. However, the WordPress ecosystem is moving more towards blocks and blockthemes. As far as I can tell, it is possible to put hooks (...
1
vote
1
answer
23
views
Alias to theme folder for local development
I am locally developing a parent theme and child themes simultaneously (perhaps not best practice, but...). It looks something like this:
parent.local
/wp-content/themes/parent-theme/
child1.local
...
0
votes
1
answer
18
views
How to get authors who have added the post in the specific custom post type
I have a custom post called event and I have to show all the authors who have added the post. I have tried the below code but I am getting all the users on the page.
For example. There are 4 users ...
0
votes
1
answer
25
views
For some time, some of my pages do not display the content anymore. Any idea where this could be coming from?
I recently worked on this website : https://semaine.com/
But since some time the content of the pages https://semaine.com/classroom/ and https://semaine.com/cinema/ are not displayed anymore.
The ...
0
votes
1
answer
24
views
How to allow certain PHP functions when using sanitize_callback in the word press customizer
Hi I am making my own theme in WordPress and setting up some customizer options and I have one for the text in my footer but I would like to still use <? echo date('Y');?> in the footer to ...
0
votes
1
answer
50
views
registering a global template wordpress 6.0
<?php
/*
* Template Name : Amaizing Inner Page 1 Template from me*
* @package WordPress
* @subpackage CADENTIC® BUSINESS THEME
* @since MY BUSINESS THEME 0.0.1
*/...
0
votes
0
answers
16
views
Getting text from custom field from customizer
So I've created a panel in the customizer section in WordPress to add the phone number to the site.
It works fine in the back end but it wont show up in the front end
here is my functions.php
...
0
votes
0
answers
27
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
22
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
18
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
48
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
15
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
27
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
56
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
22
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
35
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
55
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
53
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
38
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
23
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
42
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
22
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
15
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
43
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
30
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
17
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
29
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
40
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
29
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
23
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
19
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
29
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
11
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
23
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
11
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
31
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
48
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, ...