2,248 questions
1
vote
1
answer
87
views
Customed shortcode shows same value to the whole post query loop (WordPress Archive page)
I created a shortcode using the code below and placed the shortcode in the post query loop, e.g. archive page. At the result, all the items in the query loop show 'bread' regardless to what category ...
1
vote
1
answer
72
views
Custom Block / Shortcode / Search in Wordpress Block-based Navigation Menu?
I have a wordpress site, currently locally hosted with xampp.
Context Structure:
Child of Twenty Twenty-Five theme (block-based, doesn't support menus in Appearance-> Menu). In the site I have a &...
0
votes
1
answer
85
views
How to properly display form data using shortcode in a custom WordPress plugin?
I'm creating a custom WordPress plugin that includes a contact form rendered using a shortcode.
Here's my current code:
function custom_contact_form() {
ob_start();
?>
<form method="...
0
votes
1
answer
91
views
Why is my WordPress plugin shortcode output duplicating every time I refresh the page?
I'm building a simple WordPress plugin that fetches a random quote from an external API and displays it using a shortcode.
The problem is: every time I refresh the page, the quote seems to duplicate — ...
2
votes
1
answer
67
views
Passing arguments to a php function to manipulate the results returned on a wordpress site using functions and shortcode
I have a php function which displays a leader board of all players and stats from my database, which is working as intended. I now however want to amend the function so that i can pass data to it to ...
0
votes
0
answers
66
views
Display a WooCommerce variable product on a WordPress page using a shortcode
I am displaying WooCommerce products via the shortcode [product id="123"] on normal WordPress pages. The products have usually 3-5 variations. In order to display the variations I am using ...
3
votes
1
answer
81
views
Replace Add to cart button with a contact form if product is out of stock in WooCommerce
With help from the community, I have successfully gotten the behavior I want with variable products, but I can't seem to duplicate it on simple products.
The code used is inserted into the functions....
1
vote
2
answers
76
views
I am looking for how to pull the Post ID from a currently active page in Wordpress using Shortcode to apply in a dynamic filter
I am using Shortcode in Wordpress also using Ninja Tables. The code is pulling from a Google Spreadsheet managed by a non-developer admin person. Generally easy. I am looking to embed this in a ...
-1
votes
1
answer
62
views
Can't display the [products] shortcode on a page [closed]
I'm trying to display the shortcode [products] on a new page I created. The products don't display, (but the shortcode itself doesn't show as text (as it would if it didn't render, meaning the ...
1
vote
1
answer
255
views
Get term id of loop grid item in Elementor
I'm facing a problem that someone already faced but he did not receive an answer here : Elementor Loop Grid widget > post taxonomy | get_queried_object() of the taxonomy iteration
To be clear, I ...
0
votes
2
answers
67
views
Create shortcode for each dimension property based on product ID in WooCommerce
Summarize:
Woocommerce product dimensions are length, width and height
Scope of this question is to create a shortcode for each product dimension property individually based on product ID.
Problem:
I ...
0
votes
1
answer
54
views
Wordpress show post link as plain text if post not published
How can I cause a link in WordPress (currently 6.7.2) to display as plain text if the target post is not published?
I know how to create hyperlinks and how to create a permalink to a not-published ...
0
votes
1
answer
68
views
Adding page number to shortcodes in wordpress?
i'm looking for a way to extract a page number (for example site.com/match/2/), in this case the 2 but can be any number, and extract it to be used in shortcodes.
I added a custom permalink which ...
0
votes
1
answer
84
views
Polylang language switcher appears twice
I'm trying to put a Polylang language switcher in PHP to appear in the header of a webpage with a shortcode. I get the switcher where I insert the shortcode, but also appears at the top of the webpage....
0
votes
0
answers
78
views
WooCommerce - shortcode filter to order by brand
I'm using the following shortcode to populate all products with sale prices:
[products on_sale="true" columns="6" rows="7" title="Check our Products on Sale!"]
...
0
votes
1
answer
44
views
Conditionally display a form below WooCommerce product variations drop down
I am trying to move the variations drop down above this form I have inserted into my short description, the form developers helped me with this snippet:
add_action('woocommerce_after_add_to_cart_form',...
1
vote
1
answer
69
views
How do I create a "sold" page that automatically displays any out of stock products?
I am in the process of building my woo commerce store using wordpress and elementor but I've run into a wall as I don't know how (or if it's possible) to create a "sold" page that ...
0
votes
0
answers
26
views
2025 -> "do_shortcode" doesn´t "DO" Shortcodes, just "Plain Text"
I have a page with a dropdownmenue that is generated by [dynamic_gallery] which is fine, and I see the content I want to see listed, also fine.
But if I click on any of the items, a plain text ...
0
votes
1
answer
54
views
WordPress custom shortcode does not display some attribute value in full
I have a problem with the shortcode, it does not show me the values I enter correctly
For example, this shortcode:
function subscribe_link_att($atts) {
$default = array(
'link'=>'',
...
1
vote
2
answers
240
views
Get post's author data in a shortcode within the WordPress loop
I am building a block theme for Wordpress.
I wrote a shortcode function that is supposed to output the message "By [author's display name with author's link]".
More specifically, I am trying ...
0
votes
1
answer
415
views
How to get shortcode of an Elementor Custom Widget
I made a custom widget to display cards of some software tools (it renders them and filters them by type, tags... via the Elementor Controls)
Now I'm making the template of taxonomy terms (Taxonomy is ...
2
votes
2
answers
156
views
How to insert a shortcode into a WooCommerce PHP file?
Here below, is an existing function which is called in woocommerece-integration.php file to display the add to cart button in product cards on any WordPress page. I have a wishlist plugin which gives ...
0
votes
1
answer
144
views
Fixed shortcode download button for all digital product WooCommerce [duplicate]
I'm using woocommerce and have "virtual" and "downloadable" products. I want to create a shortcode to display a "Download" button for these products. Because there are so ...
1
vote
1
answer
98
views
Create shortcode to show specific nav menu depending on product category
I need to create a shortcode that displays a specific wordpress menu on a Woocommerce product depending on the category the product belongs to. Both the category and menu are identified by ID but I ...
0
votes
0
answers
96
views
Wp Elementor form submit to an email with custom Shortcode
I am trying to implement a WP Elementor form with a custom shortcode. I want to send the form submission to a dynamic email using a shortcode and here is the custom shortcode.
function ...
0
votes
0
answers
45
views
WooCommerce Shortcode - space between price & add-to-cart
This shortcode nicely displays the price of a product and the add-to-cart button side by side:
[add_to_cart id="xx" style="" show_price="true" quantity="1"]
But ...
0
votes
0
answers
113
views
Change Image In Wordpress by Click
My question is to create something in Wordpress.
I like to create a kind of advent calender. There are 25 small images an one big image. What i want to establish is when clicking one of the 25 small ...
0
votes
0
answers
136
views
How to call shortcodes on link or button press from a wordpress template
I have plugin that I wrote that adds a menu item to the Wordpress dashboard, which when selected, shows a template page that is coded in Templates/admin.php file.
This works, but now I am looking for ...
0
votes
0
answers
101
views
Bootstrap Accordion in wordpress functions.php
I am making a shortcode in wordpress, including bootstrap accordion so that when I put the shortcode in the editor it gives me the posts title, image, categories, content etc.
When I am putting ...
1
vote
1
answer
203
views
Hide WooCommerce product attributes with empty values from a custom shortcode
I used the code below to display a certain amount of attributes within a Custom Tab by using a shortcode. This works fine but not all products carry the same specs. How can I hide the lines that ...
0
votes
1
answer
52
views
ACF get_field not returning value inside function with foreach loop
I have a function that loops all Woocommerce subcategories for the current category. Inside the subcategory loop there is an advanced-custom-field that is supposed to display an icon. But I do ...
1
vote
2
answers
185
views
Embeding a multi line markdown variable in a html shortcode
I'm trying to display some information about a person including Picture & Biography. The biography comes from a user controlled source that accept markdown. I managed to print multiline input ...
2
votes
1
answer
248
views
Filter WooCommerce products from brand and category custom dropdowns
I'm trying to create 2 dropdowns, one for brands from Perfect Brands for WooCommerce plugin, and the other for 2nd level product categories. The category works on it own, but the brands just returns ...
0
votes
1
answer
43
views
Creating a Dynamic Panel in WordPress
I want to create a dynamic panel for my WordPress theme using PHP code. To do this, I have placed the following code in the functions.php file:
function dynamic_panel($title, $content) {
$...
0
votes
2
answers
78
views
Displaying taxonomy name in single post template of cpt
I'll start by saying that I have no background in php.
I need to embed a shortcode to display the name of the specific taxonomy the post is associated with.
The shortcode is embedded in a single post ...
1
vote
1
answer
78
views
Display product excerpt only when using WooCommerce product_category shortcode
I'm looking to use something like [product_category excerpt="yes"]
in order to display product short description only when needed.
I'm using this function below to add the product short ...
2
votes
1
answer
184
views
Display Specific Product Attribute via a Shortcode in WooCommerce Product
With the following Code I get a Custom Product Attribute from WooCommerce.
Is this code compliant or could it be solved better?
Is the global inside the function used properly?
How can I extend the ...
0
votes
0
answers
43
views
How can I get a WordPress shortcode evaluated within a template if I cannot edit the template php files?
I have created a WordPress shortcode (using the Code Snippets plugin) that works fine.
I need it to work within a template so, on my local system, I have edited post-content.php and inserted
$content ....
1
vote
1
answer
822
views
Create WooCommerce shortcode to display product reviews on single product page
I'm trying to generate a shortcode that gives me the option to display the reviews/ratings of a WooCommerce product anywhere on the single product page.
So far, the reviews are displayed by default in ...
-2
votes
1
answer
74
views
How to display a list of subcategories in order by name and not in chronological order?
The category page displays the subcategories under it using the following code:
add_shortcode( 'list_subcats', function() {
ob_start();
$current_cat = get_queried_object();
$term_id = $current_cat->...
0
votes
0
answers
38
views
I need to create a shortcode for an app form
I have custom app that uses a form to send data to Quickbooks to create an invoice. A php file on C-panel contains the code for the form. The code is posted below.
@extends('layout.mainlayout')
...
-1
votes
1
answer
95
views
Get category title with shortcode whithout a bullet list
i'd like to create a shortcode for wordpress to display the category name.
Each post on the website is associated with only one category, so there is no need to display a list of categories but only ...
0
votes
0
answers
37
views
Gutenberg / Wordpress: edit shortcode to only show posts of a specific year?
A client wants to show blog-posts of seperate years with a headline inbetween.
Right now we are showing all posts with this shortcode:
<!-- wp:ivory/posts-grid {"postsToShow":36,"...
0
votes
1
answer
71
views
Woocommerce create shortcode to display total quantity of all items sold for a shop
I'd like to get the total quanitty of all items ever sold to create a shortcode to call on in a counter.
I have used the below to call on total number of orders but now I want to get a combined total ...
1
vote
0
answers
57
views
How to create a short code for calender week in Wordpress?
I'm a total newbie at PHP/WordPress, so please help me out: I want to add the current calender week (the week number in the year) to my webpage. My idea was to first create a new shortcode in the ...
0
votes
0
answers
103
views
PHP custom shortcode is appending the word "Array". How do I get rid of this?
I have a custom shortcode that shows the last updated date of my posts. The shortcode is ouputting the proper date but is appending the word "Array"? How do I get rid of this?
//Last Updated ...
0
votes
2
answers
533
views
How do get a dropdown of all countries in Wordpress
Is there a shorter way to get all countries populated options, instead of writing options one by one, in the following dropdown?
<select name="input-country" id="input-country"
...
1
vote
1
answer
91
views
Handle refunds in customer total spend for a defined period in WooCommerce
From Get the customer's total spend for a period of 1 year in WooCommerce answer to my previous question:
// Utility function: Get customer orders total amount from specific status on a period
...
1
vote
1
answer
258
views
Get the customer's total spend for a period of 1 year in WooCommerce
Using the code from Show custom text based on total spent by user in WooCommerce:
add_shortcode('user_total_spent', 'get_user_total_spent');
function get_user_total_spent( $atts ) {
extract( ...
1
vote
1
answer
82
views
do_shortcode not considering price filters with woocommerce native products shortcode
I have some filters like this inside my plugin
add_filter('woocommerce_product_get_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_get_regular_price', 'custom_price', 99, 2 );
...