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.

Filter by
Sorted by
Tagged with
0
votes
1answer
12 views

Shortcode not working inside div html

header.php <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v10.0&appId=MyAppIDHere&autoLogAppEvents=1" ...
0
votes
0answers
7 views

Strings are not preserved when transforming a shortcode to a Block

In the way to provide a Block to my shortcode plugin, I'm trying to produce the code allowing to transform my shortcode to the Block when the plugin user activates the 'Convert to Block' feature to ...
0
votes
0answers
18 views

Using a custom shortcode from within the template of a shortcode plugin

I've written a custom plugin, ta-intentclicks which is used as a shortcode: [ta-intentclicks count="3" category="SEC-EDR"...] Within this shortcode I'd like to use another ...
0
votes
1answer
28 views

Custom shortcode for displaying user based on a role parameter

I've created a plugin that with a shortcode displays all users with the custom role "ansatt". This works perfectly fine, but I'd like to be able to set the role as a parameter within the ...
0
votes
1answer
20 views

Are Shortcode Attributes Always Passed As Strings?

Does the id in a shortcode such as [reusable id='7'] or [reusable id=7] always get interpreted by shortcode_atts()as a string regardless of whether the integer is in single quotes or not? I'm trying ...
0
votes
0answers
20 views

JetEngine: Repeater field shortcode? [closed]

Is there any shortcode to display a repeater group and its fields? By using Shortcode generator, if I want to show single field, I can use: [jet_engine component="meta_field" field="...
0
votes
1answer
29 views

Shortcode Not Working in Slider When Added To Post Title

I've coded a shortcode to add manually to specific post title fields so i can style part of a title add_shortcode( 'green', 'green_shortcode' ); function green_shortcode( $atts, $content = 0 ) { $...
0
votes
1answer
23 views

Create a CPT to edit Shortcodes Atts

I have create a carrousel and display it with shortcode and passed the image and text as attributes. However, the shortcode end up being to hard to read and edit when needed. Not user friendly. [...
0
votes
0answers
20 views

Return multiple results with same short code

I added a function in functions.php and it works fine for one result with a link mentioned in $link however I am trying to display multiple results from similar links with this function. Tried ...
0
votes
0answers
28 views

Display Custom Field Value Via Shortcode Inside Excerpt

I have the following function: function dessert_function( $atts ) { $atts = shortcode_atts( array( 'post_id' => get_queried_object_id(), ), $atts, 'dessert' ); return ...
0
votes
0answers
12 views

How to create shortcode script for full screen?

My short code returns HTML elements that are inserted into .entry-content div I need my plugin to be full screen (no header, no footer, width and height:100%) Is there a "clean" way to do ...
0
votes
2answers
20 views

Render Modula Plugin Shortcode On Ajax Request

I am using Modula Plugin to speedup the galleries creation process. It works wonderfully but I don't understand how to render it correctly on the ajax call. I read through the available posts on ...
0
votes
0answers
17 views

How to define a variable and use it in shortcode?

I am new to wordpress development as well as php and html programming and I need some help with something. I would like to get the title of a bbPress topic and then store that in a variable. Then I ...
0
votes
1answer
33 views

Custom Shortcode with Dynamic Button

I am lost as to how to create a dynamic button shortcode. Depending on the post ID a specific application form is served in a popup by clicking on a button labeled 'Apply'. At the bottom of the page ...
0
votes
0answers
7 views

Custom woocommerce product table shortcode [closed]

I am trying to write some custom code that goes in the functions.php file to create a shortcode that will display a list of products in a chosen category. Everything seems to work but there is a ...
0
votes
1answer
26 views

Shortcode not work in picture source srcset tag

I have in my WP plugin: <picture> <source srcset="[bloginfo key='template_url']/images/image.webp" type="image/webp"> <img src="[bloginfo key='...
0
votes
0answers
16 views

Multiple TinyMCE buttons with one js file

when add button, i used: $plugin_array['ghichu2'] = get_template_directory_uri() . '/js/cfx_tinymce.js'; $plugin_array['footnotes'] = get_template_directory_uri() . '/js/cfx_tinymce.js'; I merged ...
0
votes
0answers
11 views

Update shortcode when changing varients

With WooCommerce when you change the attribute options to select a variant, the Price and Stock amounts are updated via Ajax. I am currently using a shortcode on the single-product page where one of ...
0
votes
2answers
47 views

Shortcode to update user meta

I want to create a button on the front end and when user click, the value "user-meta" change 'validate' function func_change_validate() { if (is_user_logged_in()) { $current_user ...
0
votes
0answers
20 views

Is the WP audio shortcode still relevant?

I'm not very familiar with audio integration so I'm wondering why I couldn't simply use the plain <audio> element? This would avoid the overhead of medialement.js that WP seems to use. I'm fine ...
0
votes
1answer
29 views

Wordpress Plugin Insert Html Code with Shortcode

I want to insert an HTML block with a Contact form 7 shortcode. How I can insert the HTML before the shortcode is being converted to HTML? function custom_shortcode_func() { $html = <<<...
0
votes
0answers
5 views

Gallery Shortcode after every single post content

I have a blog with posts, and i want to return my gallery shortcode after the post content. I want '$after_content' variable to be the gallery shortcode. functions.php: add_filter('the_content', '...
1
vote
1answer
20 views

How can i display gallery shortcode output under Post text

so I have a shortcode for a gallery I'm using in the Single.php file for the single post pages. The problem is that the gallery only shows either at the top of the page, or at the bottom. I would like ...
0
votes
1answer
19 views

Get Posts by Category, Tag , and CPT Taxonomy

How to print only those posts which have Category, Tag, CPT Taxonomy. I have tried out with this code but nothing prints. To print posts I used SS [commonposts category="2" tag="3" ...
1
vote
1answer
24 views

Convert HTML Script to Shortcode [closed]

I want to convert this code into a shortcode from the Code Snippets plugin, I have seen an example come up but when I put it it does not work, the example is the following: add_shortcode( '...
1
vote
0answers
16 views

How can I escape a section of my page which contains multiple shortcodes?

For testing purposes I often test multiple shortcodes on the same page and examine the results. However I would like to display the short codes being tested. There are a number of websites dealing ...
0
votes
2answers
37 views

Shortcode To Display Post Custom Field Value in Post Title, Post Content

I want to create a shortcode that pulls value from a custom field of a post and parses that value on Post title, post content. So if the custom field value is Icecream for Post 1. On the admin side ...
0
votes
1answer
20 views

Best way to include reusable sections in page content

I'm fairly new to WP dev and I'm trying to work out the best method to include reusable sections/templates within the page content added within the page editor. I have included an image to illustrate ...
0
votes
1answer
144 views

Error : “Updating failed: The response is not a valid JSON response” with custom shortcode

I am building a theme into which I have integrated data recovered by an external API. I chose to create a plugin in which I put all my data processing, it allows me to generate a shortcode with which ...
0
votes
0answers
18 views

Show Content of shortcode out of div and site structure

With this function, I generate a series of shortcodes, some of which are variable. The problem is that when this shortcode is placed inside the site, the content of the shortcode is displayed, but the ...
0
votes
0answers
15 views

Save shortcodes attributes and use them via AJAX

I am trying to develop a shortcode to show people's phone numbere. I developed a shortcode and pass attributes like these: [show-phone-number name="person1" phone1="111111111" ...
0
votes
1answer
29 views

wp_enqueue_scripts does not work on admin page

I'm trying to create a slider shortcode with Slick Slider and for some reason it does not work in the admin page in the page builder and I'm getting this error: I already enqueue it in my functions....
0
votes
0answers
8 views

How can I get variation products that their variations are on sale with raw sql

I'm building a WordPress multisite. And I have shortcode that fetches on sale products. But it doesn't get variation products because they can't be "on sale". Only their variations can be &...
0
votes
0answers
18 views

shortcode containing other shortcodes not returning content

In a WordPress page, I'm using content: [accordiancontainer] [accordiantab title="First Tab"] Tabby ipsum dolor sit amet, kitty sunbathe dolor, feed me. [accordianending] [accordiantab ...
0
votes
1answer
38 views

How to pass parameters in wordpress shortcode?

Everything is working fine and it's displaying the comments of the current page with this shortcode [wpdiscuz_comments] using the code below. function my_wpdiscuz_shortcode() { $html = ""; ...
0
votes
1answer
36 views

Shortcode for Custom Field of Media Attachment (to use with Featured Images)

I'm using ACF (Advance Custom Fields) for Media Uploads to store location information about photos. When I set a post Featured Image to a photo that has this extra field, I'd like to output the ...
1
vote
1answer
21 views

How to Create a shortcode to this php function

This function allows me to show Demo Url on the single product page before cart button. But i want to display it somewhere else using a shortcode. Please help me How to do that- Here is the code: /** *...
1
vote
1answer
26 views

Create shortcodes within foreach loop (using array)

I have a custom theme that includes several template parts. I intend to use theme template parts within theme files as well as using them as shortcodes. To create the shortcodes I am currently ...
0
votes
1answer
18 views

Problem parsing long parameter in shortcode

I have created this shortcode and registered it: function product_paypal_button_display($atts){ //Make the PayPal variables available downstream. global $wpdb; global $...
0
votes
1answer
13 views

Variable inside shortcode or shortcode inside shortcode

I have a working shortcode, ie like this: [shortcode_name search="" show="url, color, size"] In this shortcode if I insert for example an email inside search (search="test@...
1
vote
1answer
25 views

Display a post by ID attribute with shortcode

I'm trying to create a shortcode that displays a banner containing a post content (thumbnail, title and excerpt), using ID attribute. My goal is to be able to use a shortcode like [postbanner id=123] ...
0
votes
0answers
24 views

How to utilise multiple values from a single shortcode attribute?

i.e [test somevalues=1,2,3,4,5] First time poster and alsoa php newb, I'm trying to add a feature to a plugin but I seem to keep triggering a debug notice from wordpress. $somearray = shortcode_atts([...
0
votes
0answers
18 views

Get a value from a shortcode for another function

I use a shortcode to get the value and try to use it to calculate the percentage $target_price = get_post_meta( get_the_ID(), 'target_price', true ); $now_price = do_shortcode ( '[stock_market_widget ...
0
votes
0answers
18 views

JavaScript missing from shortcode content

I am trying to add a short javascript as part of registering a WP shortcode. You can see my simplified code below. When I execute this on my website everything loads fine except for the part between ...
0
votes
1answer
34 views

Show history of post revisions on front end

I'm working on an internal knowledgebase and I want to show the post history on the front end (with something like author, date and difference). I first landed on wp_get_post_revision() (https://...
0
votes
0answers
17 views

Trying to add current user meta data to a shortcode and display an iframe on Wordpress

I created some custom user meta fields, which I can call normally and display the info added but when I'm trying to pass this meta value on to an iframe to dynamically generate an iframe based on ...
0
votes
0answers
21 views

Hot to generate shortcode with TinyMCE custom button in WP 5.x?

I've created custom shortcode for CTA button: function cta_shortcode_function( $atts ) { $a = shortcode_atts( array( 'url' => '#', 'text' => 'cta button', 'icon' ...
0
votes
2answers
53 views

Display page and custom post title inside shortcode

I am trying to write a shortcode to display the page title. I only got the archive title to work, but not custom post type category and single post. Can anyone shed light how to do this? The reason ...
1
vote
1answer
100 views

AddToAny shortcode in the loop

I try to add addtoany shortcode in my custom loop page but the shared link stays always the same for each posts in the loop. <?php global $post; echo do_shortcode('[addtoany url="' . ...
0
votes
0answers
15 views

Hide download option video shortcode

Is there a way to hide the video download option (not all the controls) with the shortcode [video]?

1
2 3 4 5
52