Questions tagged [shortcode]
BB-Code-like mechanism by which strings enclosed in square brackets can serve as shorthand for longer and more complicated strings. These strings are processed by callback handlers, usually on page load, which replace the bracket enclosed string with the output from the callback handler.
2,765
questions
1
vote
1
answer
39
views
Using a shortcode to get User Emails by role as specified in the shortcode, need help to allow for multiple roles
I have the following working code:
function get_emails_by_multiple_roles ( $atts ) {
$user_args = shortcode_atts ( array (
'role' => 'role' ,
), $atts );
$users = get_users( $...
0
votes
0
answers
9
views
AAPF Filter group is not in widget section
as i am trying this plugin for my website AAPF Filter group is not showing in my widget section, if i use this short code also it doesn't working [br_filters_group group_id=2661]
0
votes
1
answer
19
views
Automatically populating a date parameter within a shortcode
On one of my sites, I use Formidable Forms. I need monthly numbers (simple counts) on submissions for these forms. My current solution is to use this shortcode built-in from Formidable:
[frm-stats id=...
2
votes
1
answer
42
views
How to create a three column blog layout with a single query and with three different classes?
I am trying to achieve the following layout :
I have created a shortcode for this but I am not getting the desired result. Can anyone guide me where I am getting it wrong. Here is full shortcode. ...
0
votes
0
answers
18
views
How can I remove the wp_autop filter from a shortcode block in a block theme page template (twenty twenty-three)?
I am using a custom page template in the "twenty twenty-three" theme. I am using a shortcode block as part of the template. This results in the shortcode not running within "the_content&...
0
votes
0
answers
30
views
Shortcode to return data instead of outputting HTML?
I’ve got a shortcode plugin which allows me to output a block of HTML in one of a few different formats based on parameters.
[mm-postlinking]
[mm-postlinking id="281493" template="...
0
votes
0
answers
23
views
Add Shortcode functionality to a function that queries custom post type / taxonomy
How to output a UL of items and URLS for custom taxonomy?
The plugin 'CPT UI' (Custom Post Type UI) is very good at creating custom post types.
I have created a post type called 'Towns' that has a ...
0
votes
1
answer
85
views
Calling a function via a shortcode in javascript
I'm looking to dynamically change the page-comments option based on whether the user clicks a URL.
I have two functions to do this:
function psb_comment_listener_func(){
echo "
<...
1
vote
0
answers
18
views
Custom Plugin not Displaying in the Website Production environment (Divi)
I built a custom plugin for a website Using Divi and I am facing a problem right now getting it to display in the production environment of the website. Here are the details:
Since you can't really ...
0
votes
1
answer
46
views
Adding a css class to the gallery
I'm using WordPress 6.5 with the old editor, I'm trying to add a CSS class on the div gallery when it specified in the shortcode, the code doesn't work, can you help me ?
function custom_gallery_class(...
0
votes
1
answer
40
views
I have a php function with a shortcode to add share buttons, but I'm having an error!
I use a php function to create and add share buttons to specific places through a shortcode. It work's fine, but I'm getting this error:
Warning: Array to string conversion in ...142-custom-shortcodes....
0
votes
1
answer
21
views
Show shortcode output in menu
I would like to show shortcode output in menu like below.
How can I do that ?
0
votes
1
answer
43
views
Array to String Conversion warning in shortcode
I have a shortcode that I have been using for awhile that is suddenly causing a warning in WordPress 6.5 the error is "Warning: Array to string conversion in ... on line 109" - line 109 is ...
0
votes
0
answers
12
views
Product description is mixed in shortcodes
Product description is mixed in shortcodes I am trying to remove the shortcode in the google feed description. Descpription is not looking very good.If anyone can help , I tried searching on google ...
0
votes
1
answer
40
views
Why does my JavaScript work in the browser console but does not work in my shortcode?
I am trying to create a shortcode the user can just insert which creates a button that loops through an array and displays it or hides it. On page load I want every item with an index >= 1 to have ...
0
votes
1
answer
39
views
Getting the wrong featured image on archive page
I assigned my posts archive to a site on settings -> reading.
I added a post thumbnail to this site, and i want to show the image with a shortcode i have written in my plugin. The problem is, that ...
0
votes
0
answers
85
views
How to add button to WYSIWYG to insert shortcode with params (filled in system popup)?
It seems to me that there must be a solution, but I haven't found it.
During the theme development process, we create many shortcodes for inserting unusual html layouts into the text.
It would be ...
0
votes
2
answers
43
views
Shortcode to show author role on the author archive page
I have an archive page to show each author domain.com/author. On the archive page for an author domain.com/author/john-doe I want to display few information like name, e-mail address and role like ...
0
votes
1
answer
30
views
Custom Field in Page Title
I need to show a custom Field in a title (CPT) I have this code
function wpse_224340_document_title($title){
global $post; // make sure the post object is available to us
if(is_singular('mec-...
0
votes
1
answer
27
views
Nav Menu Short code Not working When non Login
I have made a toggle button with short-code for dark/light mode code below
function dark_light_toggle_button_shortcode() {
ob_start(); ?>
<!-- new button -->
<div id="...
0
votes
0
answers
98
views
How to make this shortcode not refresh the whole page when i use it on frontend
everyone, I have this code that makes all the files in a folder visible and downloadable on the frontend through a shortcode. But I want to put it in Essential Addons' Advanced Tabs, and they don't ...
0
votes
0
answers
18
views
Sidebar inside page conten
I have WordPress page's or pages' layout like this:
I'm wondering what would be the best way to handle this.
I was thinking about adding shortcode inside column, that would export widget area:
...
1
vote
2
answers
264
views
wp:shortcode works in block theme template file but not PHP include file
Block markup generally works in included PHP files. I prefer to use PHP includes in many cases as I can do more interesting things with it than I can with a template file (.html). I've just ...
0
votes
1
answer
55
views
shortcode appears as text in the search result
I have a shortcode added to the listing grid and the shortcode is working fine but then it displays it as text on the search result.
<?php
function booking_popup_snippet() {
// Get the wpcode ...
-1
votes
1
answer
53
views
Display the progress of post achievement with percentage against target in wordpress dashboard
I have a cpt called "movie", and I set a target for writers to make 50,000 posts in 6 months. The question is... can I make a percentage of the results of the number of recent posts against ...
0
votes
0
answers
24
views
Want to call shortcode after every blog post title automatically
i want to call shortcode after every blog post title automatically. It's a search box which already using on pages when i place the shortcode, now i want to add it on my 500+ posts once, is there any ...
1
vote
1
answer
73
views
How to get next day date of a specific day
I have created a shortcode in WordPress to show next day date of a specific day but it does not show the correct date when I am passing the parameter through the shortcode. Can anyone tell me what I ...
0
votes
0
answers
23
views
add a meta value to the shortcode twice
I would like to build a shortcode looks like below.
[employee_session trigger=session-popup-1 trigger_type=id in_dialog=1 employee=1]
[employee_session trigger=session-popup-2 trigger_type=id ...
0
votes
0
answers
26
views
post_content return zero!
I am new to WordPress
I made a function as a subscription form.
when I want to check it on another function I use
global $post;
if (has_shortcode($post->post_content, 'up-vip')) {....}
I don'...
0
votes
0
answers
5
views
"Joined in" or "Member since" displayed on single store page and then using shortcode to add
I'm trying to add the registration date of users (vendors) to my single store page. This would ideally read "member since (date)". I also want to use shortcode so I can apply this manually ...
0
votes
0
answers
27
views
Products are displayed only in the admin area
I have a code:
$products_query_params = array(
'post_type' => 'product',
'product_cat' => 18,
);
return new WP_Query($products_query_params);
I need it to get products. But it works ...
1
vote
1
answer
24
views
Which PlugIns have a [subpages] shortcode? [closed]
I'm repairing a site that was hacked a long time ago.
I have many pages that have this in them:
[subpages]
(and I think that's called a short code).
The plugin is gone, so the page just shows the ...
0
votes
1
answer
161
views
How do I edit text color for shortcode?
I am trying to learn web development and using WordPress to make a site. I have Event Calendar, and Event Tickets Plugins. The Event Tickets Plugin uses short code to generate a checkout page after ...
0
votes
0
answers
23
views
Plugin Inserts content before Page Content [duplicate]
I have a plugin that pulls comic book data from the Marvel API. I have assigned it a short code. When I place the shortcode on the page it does the following:
Before:
After inserting the shortcode it ...
0
votes
0
answers
25
views
add_action to only be called if uploading media from the front end
I have written a shortcode which allows some users to upload to the media folder. This is done using the wp_enqueue_media scripts.
I would like to add an action which fires when a user uploads this ...
0
votes
1
answer
175
views
How to create blocks from shortcodes?
I want to create a shortcode of myself that outputs “blocks”.
Level 1: Setting a pure text
I know how to do a simple shortcode. Let’s take this example.
add_shortcode( 'greet', 'myNiceShortCode' );
...
0
votes
0
answers
16
views
How to add content region to a post or a page
I need to add a region to a certain pages. Currently our posts are one column. What we need to do is to add region where we could display Table of Contents so it would become two column layout ...
0
votes
1
answer
24
views
Update shortcode values using ajax call
I'm having a problem with a calendar, I've made a shortcode which returns events links in a grid that shows the current month view.
I set $month_index in order to navigate through months (default is 0 ...
0
votes
1
answer
34
views
php codes ruins shortcode structure
I'm trying to use shortcode in index.php but when I use PHP code in my shortcode, it displays out of shortcode structure.
this HTML code works
<?php echo do_shortcode('[myshortcode label="...
0
votes
0
answers
74
views
Global variable not showing in shortcode
I am trying to show some variables when I hover over products image. For that I am using a shortcode to show the variable I need and the function do_shortcode(). However the needed variable is not ...
0
votes
0
answers
37
views
How to add a shortcode for an image in the following function
This is a function by Tobias Keller for PRG Pattern Link Masking where title shortcode is link text. How то add image shortcode alternatively instead text ?
$use_prg = new prg_pattern();
class ...
0
votes
1
answer
93
views
How to make my logged-in user-role shortcode displaying name instead of slug?
I am trying to get my frontend to show the role of a logged-in user via Shortcode. I have the Shortcode functional (see below) but it displays the slug and not the real name in the frontend. This is a ...
0
votes
0
answers
20
views
How to trigger shortcode loaded by CSS
My theme has an option to display the tagline in logo area of the header (tagline added using theme Site Identity settings)
Using CSS I can supplement the tagline with additional content (words etc).
...
0
votes
1
answer
312
views
correct way to enqueue js and css files for wordpress shortcode?
I have created a php class file. I am enqueuing the required CSS and JS files in the class's constructor.
public function __construct() {
add_action('wp_enqueue_scripts', array($this, '...
1
vote
1
answer
74
views
shortcode causes broken paragraph tags
I'm learning how to use short codes but I don't undrestand why WordPress keeps rendering broken paragraph tags.
I created a file called wp-content/themes/twentytwentythree/templates/single.html with ...
1
vote
0
answers
40
views
Can I add two wordpress shortcode plugins in the same site (not the same page)?
Is there a problem with defining the same subdirectory structure for two or more WordPress plugins ? I have the following structure for my two plugins :
Then in a wordpress page I insert the first ...
0
votes
1
answer
1k
views
get_the_ID() retrieves same ID on Gutenberg's Query Loop
I'm using Gutenberg editor and I want to add a shortcode (using XYZ PHP Code) that uses the post id to retrieve certain ACF value.
I'm editing the home page where the last blog posts are shown, but I ...
0
votes
1
answer
137
views
SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop
I'm creating a template for a custom post type & I'm trying to add a WP Query loop displaying specific Divi projects filtered by tag. I'm inserting the loop using a shortcode, & I've ...
1
vote
1
answer
47
views
Resending woo-commerce order emails from frontend
I am trying to create a simple shortcode [resend_woo_emails].
This shortcode will create a form with a dropdown with all email classes, an input field for cc emails, and another input field for ...
0
votes
1
answer
27
views
Strip and print only the numbers found in current's post excerpt (even if they are without space)
I have a working code for printing just the year (number) if found in the current post excerpt, but the problem arises when the number (a year) is followed by a Japanese character (example: '2023年', ...