Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
2answers
41 views

Get list of shortcodes from content

I need a list of every shortcode inside the content. Is there any way to list them? This is what I need: $str = '[term value="Value" id="600"][term value="Term" id="609"]'; So every shortcode ...
0
votes
1answer
14 views

Add panels with images and description in wordpress

Good day! I wanted to add a panel into my website homepage complete with panel heading and body. I also wanted to add an image inside the panel body but I have been very unsuccessful. I have been ...
0
votes
0answers
11 views

Gutenberg Block: Render Shortcode

I'm working on a WordPress plugin using cgb-scripts to create blocks. That makes development very easy, though there is hardly any dynamic blocks support. I found out, that when creating a block I ...
0
votes
0answers
22 views

Why my Ajax events are no longer detected after dynamic change of shortcode content

I have two input select (dropdown) in the content of my shortcode. The first is created when initializing the shortcode content, while the second is created when the user chooses the value of the ...
0
votes
0answers
12 views

How to wrap ALMOST all content in a div for all old content?

Nearly all of my posts have normal content but then ends with a shortcode. So, h2 elements and paragraphs, but then at the end of the post, the shortcode that ends up implementing a div tag with ...
0
votes
0answers
12 views

Show template notice instead of reply form when user is logged out

When using the shortcode [bbp-reply-form], how do I display a template notice in the place of the form, like “You must be logged in to reply to this topic.”, when the user is logged out? Its only ...
0
votes
1answer
19 views

Shortcode to insert default text and change one word throughout it?

A beginner developer here, working on my first project. I've been trying to find some guidance on how to create a plugin or function to create a specific shortcode. Let's say I have two default ...
0
votes
1answer
20 views

how can i show WordPress custom field data to my short code?

I want to pull Sub Heading text using WordPress default custom field? i use this shortcode. but not showing any text? //Shortcode: [lplist catname="" lpimgbg="" lpcatheading="" lpbtnurl=""] function ...
0
votes
1answer
23 views

Add Shortcode to ::before class

I want to add a button (that will open an INFO popup screen with info about a certain option in a woocommerce variable product), all that can be easily created with a plugin that converts the whole ...
0
votes
0answers
31 views

WP_User_Query Search Multiple Keywords from a Multi-Select Field?

My code below works to list a single user when I ask to search for a single username; however, I am unable to list multiple users when asking to search for multiple usernames. Here is a brief ...
0
votes
1answer
25 views

Reload page with a different shortcode when a user selects from a dropdown

I'm using WP Job Manager, and the page which lists all available jobs is delivered using a shortcode which can be customized. so [jobs per_page="10"] is outputed in the frontend as: <div class="...
0
votes
0answers
10 views

Buddypress shortcode to display Site Directory [closed]

Looking for shortcode to display Buddypress Site Directory. Any reference appreciated.
-1
votes
0answers
25 views

Proper way of calling AJAX from plugin

I am currently doing it like this and I know that this isn't the right way. I have 2 plugin files which will be named as index.php and process.php. index.php will show the form while process.php ...
0
votes
1answer
7 views

Shortcode not working when I output data from wpdb html table row

So I created a custom page in dashboard with a tinyMCE editor that can save html in a table row that i created in wp db. I am also able to output the html on a custom template page. However the ...
0
votes
2answers
29 views

How to use plugin's shortcode in custom design? [on hold]

This might be a beginner question, for disclaimer I'm just getting used to the WordPress templating system: I have a purchased theme installed on my working WordPress site, looking great sofar, was ...
0
votes
0answers
11 views

shortcode to display content in list format in yoast FAQ block [on hold]

i am adding rich snnipet using Yoast content blocks in post.I want to display my content in list format in yoast FAQ block. i tried to add using nested shortcode but it doesn't work pls help as soon ...
0
votes
0answers
11 views

Linking WordPress User Profiles Together With Shortcodes

I am using Ultimate Member, and have franchise owners as one user role and shops as a different role. On the franchise owner profile, I have included a shortcode (that I need help with) to display the ...
0
votes
0answers
24 views

Woocommerce “products” shortcode with “on_sale” not 100% working

I am using the following shortcode to display a paginated page with all products currently on sale on the store : [products columns="6" per_page="12" orderby="date" order="DESC" paginate="true" ...
0
votes
1answer
45 views

Shortcode don't work in custom option field, any solution?

I have a custom field in the theme Customizer that allow to define own copyright information. I created a shortcode displaying the current year. How to make the shortcode work when someone has pasted ...
0
votes
0answers
17 views

How can I create a shortcode from an html and php code written together

How can I create a shortcode from an html and php code like below: function hire_feedback_surveyyy() { $product_id = 21876; // We get all the Orders for the given product ID in an arrray $...
1
vote
1answer
19 views

Creating a shortcode, but getting tied up with OOP and Classes?

I have tried creating a new class that holds an action which creates a shortcode and the shortcode is on my site but doesn't appear to be working. Can anyone tell me where I appear to be going wrong ...
1
vote
1answer
23 views

Custom Theme, Custom shortcode not working

ENV: WordPress version 5.1 / MAMP Pro php v. 7.2.14 I'm building a new, custom theme for a site that has an old, custom theme. The new site is just a single theme, while the old site has a parent ...
0
votes
2answers
25 views

I want to show category name when using [category] shortcode

I want to show the category name of the post when I write [category] shortcode in the post body. I'm using this code but only showing array error. Sorry, I'm not an expert in coding. Perhaps you can ...
0
votes
1answer
23 views

Load gravity form via ajax using do_shortcode

I am reloading my form using ajax upon confirmation. This is working perfectly and I am parsing my form_id to the action function fine... // code to trigger stuff when forms have submitted $(...
0
votes
1answer
19 views

How I can add placeholder in shortcode

add_shortcode( 'show-the-views', function( ) { ); $count = get_post_meta( get_the_ID(), 'views', true ); return $count . ' views'; }); This code is working but I have to add a placeholder ...
0
votes
1answer
31 views

Custom Shortcode AJAX 400 Bad Request

I'm writing a custom shortcode that will need to call some PHP file via AJAX, after some user event. But I am getting Bad Request 400 as if my wp_ajax_* actions aren't being bound. Here is a simple ...
0
votes
0answers
12 views

Teaser Image Shortcode Link [on hold]

I'm using the following code which is a image teaser shortcode used within my theme: [tg_teaser columns="one" image="http://blah.com/image.jpg" title="title goes here" align="left" bgcolor="" ...
0
votes
1answer
13 views

I'm using rtMedia and Youzer. Can Shortcodes be used to display a video gallery?

Please be patient if This doesn't make sense. I'm using Youzer which adds advanced social networking features to BuddyPress. I also added rtmedia to allow users to upload videos. How do I use the ...
0
votes
1answer
30 views

how can i pass this attribute in this shortcode?

Only catname works. but how can I show other value? here the full code: https://pastebin.com/RweNnSP0
0
votes
1answer
32 views

Handling PHP/HTML inside the output of a shortcode function

I'm not sure what I'm doing wrong, but the output of my custom shortcode isn't producing on the front end of the page. I need to load a script from within the output code of a shortcode function. ...
0
votes
0answers
28 views

Including content into an add_shortcode() function

my_html.php <?php global $wp; $op = get_option( 'mcc_d' ); $post_title = get_the_title(); isset( $this->op['mcc_d_text'] ) ? $mcc_d_text = $this->op['mcc_d_text'] : $mcc_d_text = ''; $...
0
votes
0answers
19 views

Add default custom excerpt that executes a shortcode

I'm trying to get a default custom excerpt for posts. I've got a shortcode that executes if it is manually entered into the WordPress post editor excerpt meta box. To do this functions.php has ...
-1
votes
0answers
18 views

Is there a way to add an alt text for a shortcode?

Let's say I have a shortcode that does something. It runs some code and places the output on my wordpress. [customshortcode id="test"] Now this shows up fine for the user. However, I would like the ...
0
votes
1answer
50 views

Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?

WordPress 5.2 destroys structured data by adding rel="noopener noreferrer" to widget output (also to shortcodes): How to display the shortcode output without code change? This feature was added in 5....
0
votes
0answers
28 views

Add a url parameter to the current post and read it in a shortcode

I am trying to add a parameter to the currently visited url but it doesn't work. I've tried query_vars, pre_get_posts, post, post_link, page_link,post_type_link.... None of this work... How can I ...
0
votes
1answer
64 views

Shortcode to delete post from front end

I'm trying to create a short code to delete post that user publish from the front end of my site. I've tried the short-code below but I keep getting the error "The link you followed has expired." ...
0
votes
0answers
15 views

How to display report of users using Gravity Forms?

I am using WordPress and the Gravity Forms plugin. I am trying to print/run a report of users based on meta key, meta value and role selections, using a simple Gravity Form to choose those selections. ...
0
votes
0answers
20 views

How to Call Related Post based on Categories Inside Post Content with Shortcode?

I'm currently working on a custom shortcode. I plan to make it enable to call related posts based on current category. Here's the working code: function seniberpikir_bacajuga( $atts ) { ...
0
votes
1answer
22 views

Shortcode for Listing Users from Meta Value?

Trying to display a list of users that match certain criteria using a shortcode with parameters. Here is what I have so far, but for some reason it does not display anything. I am pretty new at this ...
0
votes
0answers
9 views

How do I get a WEBVTT file to work with the video shortcode?

I'm trying to get a WEBVTT file to work with the Video shortcode, but I can't find any info on how to do it. Accessibility is so important, I'm sure this must exist right, there must be some easy way ...
2
votes
1answer
27 views

How can I default to all WordPress roles when parameter is not included in shortcode?

I am trying to set up a generic shortcode in WordPress with parameters for user meta key, meta value and roles that will count the total number of profiles that include certain values. So far I have ...
0
votes
0answers
46 views

How Can I Display the Last Modified Date for User Profiles on WordPress?

I'm trying to add a "last modified" date to user profiles on WordPress. I'm using the Ultimate Member plugin, so I would prefer to to find a way to save this date to a meta-key that I can pull when I ...
0
votes
1answer
39 views

Hide password protected dynamic content in templates via shortcode

I am using this plugin https://wordpress.org/plugins/content-protector/ Enter the correct password to view the content↓ [passster password="123456"]content here[/passster] adding to php↓ <?php ...
0
votes
1answer
29 views

Custom shortcode to display posts, first post is full

I'm trying to create a custom shortcode to display the last x-amount of recent posts. But the feature of this shortcode is that there should be a possibility to show the first post, most recent, at ...
0
votes
0answers
24 views

Add the shortcodes from the enfold theme to the other theme

A WordPress website uses the enfold theme and its content is created with the avia page builder. We have created a new template when it displays the text with the theme of the previous code shortcodes....
2
votes
1answer
44 views

Display sorting options dropdown when using WooCommerce product category shortcode

I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot: Now in another page let's say example.com/foo On that ...
0
votes
1answer
35 views

How to change dynamically page title according to variable data?

I created a shortcode for creating dynamic pages with the help of API data. If someone changes the page title I also want changes. Now I have a dynamic page title in a shortcode function, but I need ...
0
votes
1answer
17 views

Help with a function to create a shortcode

I have this code that I use to show random posts that are cached using transients (obtained from here). I want to show it using a shortcode in a footer widget. Could anyone kindly help me with a ...
0
votes
1answer
17 views

WordPress User ID as Shortcode

I want to use this as a shortcode to show in any post/page <?php $user_id = get_current_user_id(); if ($user_id == 0) { echo 'You are currently not logged in.'; } else { ...
0
votes
0answers
27 views

Shortcode callback not called

I don´t why for some reasons, my callback function is not called for this url : https://my-site/?post_type=foo-login&p=11 In the database is like this : +----+-----------------------------------...