Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
4,455
questions
0
votes
1
answer
58
views
How to store the third party script with HTML code in the wordpress custom input field?
I have created a custom field on my custom post. Below is the code I am using for the custom field.
<?php
function wpt_add_thirdpartyvideo_metaboxes() {
add_meta_box(
'...
0
votes
1
answer
104
views
How to access index file in Block Themes?
I'm new to wordpress code and read that index.php is located in the root/themes/yourtheme/index.php.
When I open index.php in the twentytwentytwo folder in my wordpress directory, it sais that block ...
0
votes
2
answers
28
views
Getting Same Description in All the Custom Taxonomy Posts
I have developed a custom taxonomy post type. I have displayed categories & inside categories posts/(products).
I am getting the Post title & Image as they should be (which I add), but the ...
3
votes
3
answers
235
views
Hide 2022 Parent Theme Templates / Parts
I'm playing with the new FSE and 2022 theme. I made a child theme and know how to create my own custom template/block parts but how can I hide the parent theme template I don't wish to use like ...
0
votes
0
answers
1k
views
getBoundingClientRect() showing different values on load vs scroll
I'm working on a site for a client and trying to implement custom parallax functionality. I have used the following code -
var inView = function(element) {
// get window height
var ...
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&...
0
votes
1
answer
478
views
get main URL from subdirectory with php
I have a WordPress site that contains multiple subdirectory installations of WordPress with individual databases inside one WordPress installation, and I want to link them together in the themes. But ...
0
votes
0
answers
80
views
How to separate two columns from one content on a page template?
I am just creating my first serious web project built on Wordpress and during my task (basically learning by doing) i came to a following problem. The designer wants to show two columns of text on ...
0
votes
0
answers
211
views
Widgets are not displaying in the admin panel
I am using WordPress, I have an issue with the widget. I am not getting the widget in the WordPress admin panel.
I am getting the error in the console
Uncaught (in promise) TypeError: null has no ...
1
vote
1
answer
68
views
Add, edit specific CPT with custom role
Who can help me with roles and capabilities?
I am stuck on this and I need some help.
I want a role that only can add, remove edit etc. a specific CPT.
What I have so far
add_action('init', function(){...
0
votes
1
answer
145
views
Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
I am working in a WordPress site that has many custom post types, and extensive use of Advanced Custom Fields (ACF). The site also uses node modules, custom code from scratch, and Git in favor of a ...
0
votes
1
answer
152
views
How to copy page/post from one theme to another?
I was using default wordpress 2022 theme and created few post & page templates from Appearance -> Editor -> Templates. These templates are lost when I switched to a child theme. Is it ...
1
vote
0
answers
28
views
custom taxonamy and post type
I have a little problem with showing of my taxonomy template my codes to create custom post type are:
function setup_projects_cpt(){
$labels = array(
'name' => esc_html_x('Projects',...
0
votes
1
answer
300
views
How to display posts from a certain category in a bootstrap 5 carousel loop with multiple items?
I am a newbie developer who is still learning, and at the moment I am developing my very own first wordpress custom theme. However, I am struggling to get this working. I Have a "Hero" ...
0
votes
1
answer
345
views
how to get this tax_query working?
I have wp_query including custom taxonomy terms which works if all the fields have values. Otherwise, it is giving 0 results.
This is the form that is used to get the taxonomy terms.
Based on the ...
1
vote
2
answers
505
views
how to display search term in the template full site editor
i am building a template for the search page (in full site editing, therefore html and no php), and i want to have a search results heading. i have this:
<!-- wp:group {"layout":{&...
0
votes
1
answer
41
views
Not sure how to debug this npm install error. This is a wordpress theme that comes with a built-in gulp/webpack task automation [closed]
So I downloaded and installed this theme that comes with a built-in gulp/webpack task automation. I went over to the project folder (wp-content/theme/themename) and just ran npm install but I got this....
0
votes
0
answers
19
views
How do you create a custom category widget that you can style?
My first time developing a WordPress theme, and I'm having a hard time understanding the widgets portion of it. Mainly because of my limited understanding of PHP.
This is what I want my categories to ...
0
votes
2
answers
1k
views
What is the best way to define constant options for a theme?
By constant options I mean properties of the theme that don't change during every day use in production, but are changeable by the developer primarily for reusability purposes. Things like custom ...
0
votes
1
answer
29
views
How to specify a template for a path like http://example.com/something?
I created a custom post type ('explore') that we use in the site. The pages for this section live at http://example.com/explore/page-name
These pages work just fine, but if a user were to back out of ...
0
votes
0
answers
392
views
Permanently deleted posts still exist
So, I deleted multiple post of type page (sent them to trash, went to trash and permanently deleted them), but one of my functions didn't work like it was supposed to so I went and investigated, it ...
1
vote
1
answer
19
views
Show notice just below the search form on the themes page
I want to show a notice on the theme installation page. I have used the admin_notices hook but it is showing the message above the search box.
I want to print the notice at the place of a black line ...
0
votes
1
answer
337
views
How to update mark-up of a gallery block in a custom theme?
I’m developing a custom WordPress theme and it’s my first time working with WordPress in a little while. I can see the post and page editor has been completely overhauled, and posts and pages can be ...
0
votes
2
answers
96
views
Why would you use esc_attr() on internal functions?
I see a lot of these in premium themes/plugins.
#1 - Why would you escape this? It's your own data. For consistency?
function prefix_a() {
$class_attr = 'a b c';
// Some more code.
...
0
votes
0
answers
120
views
How to show comments from different Plugins to same post type?
I have two different comments, but both are related to the same post type.
The first comments in this way:
<?php
if (isset($_POST['submit_tickets'])){
$tickets_reply = $_POST['...
0
votes
2
answers
124
views
Extend Wordpress Core Classes in OOP Theme?
What is the best way of using WordPress's core classes in the context of an object-oriented design?
I am trying to use $wp_admin_bar to remove a couple of the default WordPress designs but I am not ...
0
votes
1
answer
190
views
Getting the category title / description returns first matching post?
I'm working on a template-part called heading which displays the page heading and an optional subtitle underneath. I have it working on pages, but on archive pages like our blog or product category ...
1
vote
3
answers
233
views
No matching template found when using single.php
I am building my own WordPress theme. I have the front page working. However, when I try to view a test post full of Lorem Ipsum, I get the "No matching template found" error.
I have the ...
0
votes
0
answers
60
views
How to get the custom post data using post id in WordPress?
I am using WordPress, I have to get the custom post type data using post id and I tried the below code but I am getting the error
WordPress database error: [You have an error in your SQL syntax; ...
0
votes
0
answers
41
views
Show the number of the post
I'd like to show the Number of the post near the post in a category. It's simpler to explain with a drawing than with words:
My first solution was a simple counter inside the loop, but it doesn't ...
0
votes
1
answer
15
views
How to get URL of category of a custom post?
I`ve created a custom post type with categories. How can I get the URL to display only posts from a specyfic category of that custom post type?
1
vote
1
answer
804
views
Invalid hook call on save, not edit when using swiper slider
I have installed swiper slider (react version) and created a custom block. When I add the block in the backend it works swimmingly and I can swipe just fine. But when I save and view in the frontend ...
0
votes
0
answers
634
views
PHP Parse error: syntax error, unexpected 'endwhile' (T_ENDWHILE), expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 124
Trying to help a friend move her website to a different host. Website works fine but when I move it I get the following error:
PHP Parse error: syntax error, unexpected 'endwhile' (T_ENDWHILE), ...
0
votes
2
answers
57
views
plugins not working in custom theme
I am creating a custom theme. In it I am trying to add salon booking plugin. This plugin creates default booking page. When I am viewing the booking page I cannot see the booking form. I have tried ...
0
votes
1
answer
209
views
Show only pages you are author of
I am trying to only show pages that a user is the author of for any role other than administrator. The code below seems to put the site in an infinite loop and it ultimately dies.
add_action( 'load-...
0
votes
1
answer
145
views
Get next and prev item from custom WP_Query and Custom Post Type
I want to make a pager for a custom wp_query where I can have a prev and a next.
I have a CPT called family and I must show the families that meet the condition that their status is Retained, ...
0
votes
0
answers
853
views
Pass custom props to <InnerBlocks.Content />
I have a parent component and want to pass some custom props down to the child. The below is my save function. I want to pass the number of columns the user chose in the parent component and pass that ...
1
vote
0
answers
62
views
How to access noticeOperations from withNotices
In my edit.js file I want to access noticeOperations which I thought I could do via props but if I console.log props it isn't there.
import {
withNotices,
} from "@wordpress/components";
...
1
vote
1
answer
1k
views
Proper way to use useSelect
I am using useSelect to get available image sizes and then I want to check that the images actually have these sizes as there may have been some custom image sizes added.
What I have done is working ...
0
votes
0
answers
2k
views
How to override any plugin file in the child theme
I have a plugin template that I need to overwrite but I need to be able to put the updated file in my theme to avoid changes getting overwritten by updates.
The file is located at '/wp-content/plugins/...
1
vote
1
answer
169
views
Are block templates incompatible with serialize_blocks?
I need to dynamically create posts from arbitrary content using wp_insert_post() and wp_update_post(). The post type I'm working with has a simple block template associated with it, so my goal is to ...
0
votes
1
answer
150
views
Wrong activation/confirmation link in email
I've created a custom login page login.php inside the root. (e.g.: http://www.example.com/login.php)
/*
LOGIN PAGE.
*/
// Login URL.
function custom_login_url($login_url, $redirect, $force_reauth ...
0
votes
1
answer
29
views
Release the plugin in the WordPress repository where redux is used
I am developing a plugin for the WordPress repository.
I'm going to use redux for the settings.
redux is a wordpress option managment plugin. https://wordpress.org/plugins/redux-framework/
But I do ...
1
vote
0
answers
46
views
What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
my question is this: assume I have a php-themed WordPress site with an event calendar page template that's using post type "event", which in turn has a lot of custom fields that hold the ...
1
vote
1
answer
374
views
WooCommerce get_price returning wrong price when used via ajax
I'm working on a site that uses the Events Tickets plugin, and I need to get the price of a ticket (Woo product) by ID. I'm using wc_get_product( $ticketID )->get_price(); to to do this.
Adding the ...
1
vote
1
answer
30
views
can i fetch a custom metabox data in another page or post type?
I need to fitch a metabox field data in another page ,
$headabouttitle1 = get_post_meta(get_the_id(), 'head_title1', true);
this is how i fetch it in the same page , I need to fitch it in another ...
0
votes
1
answer
48
views
Making a child theme for "Airi"
I had chosen the Airi theme for my WordPress website. I planned to make some customizations and decided to use a child theme.
I had studied the WordPress documentation page https://developer.wordpress....
1
vote
1
answer
1k
views
How to add InnerBlock multiple times in the same block
When I click a button to add a new tab, I would like to have an <InnerBlock /> so I can add other blocks within the tab. Trying this does not work as the same seems to be in all the dynamically ...
0
votes
0
answers
612
views
How to create nested array attribute
I want to create a nested array attribute but not sure how.
I think the JSON would look something like this. I want to have a tab with multiple tiles inside each tab.
{
"tabs": [
{
...
0
votes
1
answer
539
views
How to only load css for used blocks on frontend
I am trying to figure out how to only use css for the block/blocks actually used on the frontend. With my current setup everything is bundled into my build/frontend.css file and so just using one of ...