A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
15 views

Shortcode custom query not passing value

I have created a shortcode to show custom single custom post type to another post. Here is the code: function clients_shortcode(){ $output = ''; //Attributes $defaults = array( '...
0
votes
0answers
16 views

How to generate auto shortcode for custom post type same as Elementor Template?

I want to generate auto shortcode for custom post type. This is same as the elementor template shortcode. I have a custom post type named clients and there are many clients. Single client post type ...
0
votes
0answers
21 views

Shortcode is not showing content when placed in editor (post_type = page)

I have created a shortcode, which I want to use in pages. When I place this shortcode in a page (post_type = 'page'), it does now display the content. But if I place the same shortcode in a post (...
0
votes
0answers
11 views

custom taxonomies not working

I am trying to make a template for my custom taxonomies. I want to create a shortcode so that i can decide how many taxonomy I want to show and some other settings. But the code is not working. ...
0
votes
1answer
33 views

Shortcode select another dbbase

i need connect another database in same host and return product value(woocomerce). The return is null add_shortcode('product_project_test', 'product_project_test'); function product_project_test() { ...
0
votes
1answer
29 views

List taxonomy term slugs within shortcode (do_shortcode)

I'd like to list the taxonomy terms within my shortcode. This is how I get the list of terms (separated by commas): <?php $terms = get_the_terms( $post->ID , array( 'shoptype' ) ); ...
0
votes
1answer
21 views

Advanced Custom Forms PHP formatting for do_shortcode

Hi i am trying to build a simple wordpress template template and want to introduce a pdf viewer into the page that pull's it file from an ACF field I am pulling my hair out with the syntax on the ...
0
votes
2answers
51 views

Shortcode not being executed

I place the following code within the WP 'init' callback (or when plugins are loaded). add_shortcode('my_shortcode', function($atts, $content ='') { die(); } ); if (!...
0
votes
1answer
17 views

Wrap shortcode inside custom block

I use this shortcode very often: [foo]123[/foo]. I'd like to drag and drop a custom block in the block editor, instead of typing the shortcode (and making typos). So how do I create a custom block, ...
0
votes
1answer
38 views

Is it possible to add a shortcode below post title?

I have a shortcode that I want to place below title of all my posts. Is there a hook or a filter I can use for this?
0
votes
1answer
18 views

Get Current Post ID in WP Loop For GiveWP

How to get current ID for WP Loop in my case? I try to loop the GIVEWP (Success), then I try to echo shortcode of GOAL Progress Bar of GiveWP but the problem is, i don't know how to get the current ...
0
votes
0answers
12 views

How to use the addthis plugin shortcode in blog main page for each blog

I am using the addthis plugin shortcode in my CPT main page for each blog. For Example: Blog1 Title [Addthis shortcode here] Blog1 Excerpt Blog2 Title [Addthis shortcode here] Blog2 Excerpt ...
0
votes
0answers
14 views

Advice on Designing Membership Plugin

I would like to develop a custom Membership Manager Plugin that lets members pay/invoice dues, RSVP for events, and have a public profile page displaying customization information. Each member has ...
0
votes
0answers
17 views

Multiple shortcodes with embedded JavaScript code in same page, how?

I'm developing a plugin that use shortcodes to display some "special" buttons on frontend. These shortcodes generate HTML, CSS and JavaScript for the button so, if the user insert multiple shortcodes ...
0
votes
0answers
11 views

wp_video_shortcode_override in post editor

I am using wp_video_shortcode_override in my plugin to override default wordpress video and it works well in frontend. My question is is it possible to make this work in post editor backend? ...
0
votes
0answers
13 views

How to add star rating in existing Testimonial Section WordPress

The theme already has testimonial section but it doesn't contain star rating in it. I want to add star rating along client profile and comments. Can someone quick guide how to do it? I already ...
0
votes
0answers
5 views

How to create table of content from page title tags?

I'm looking for a code snipet for automatically generating a table of content taht i can add inside the php page of the article. Basically the table of content should be generating title tags with ...
0
votes
1answer
42 views

How to add a PHP scripts into Wordpress

I have some PHP scripts around 60, which contains images that every 10 secs are refreshing, the source is from a live streaming server. My question is how to add them to WP? Some the code is on the ...
0
votes
0answers
23 views

Post does not show category wish just show latest post

function category_post_shortcode($atts){ extract(shortcode_atts(array( 'title' => '', 'link' => '', 'category' => '', ...
0
votes
0answers
14 views

wordpress custom category post shortcode

Does not work this code... function category_post_shortcode($atts){ extract(shortcode_atts(array( 'title' => '', 'link' => '', 'category' => '', ...
2
votes
2answers
37 views

Custom plugin issue when trying to use the shortcode twice on a page [closed]

and thank you for any help you can provide. I've been trying to address this issue for a couple of days now, but I've found myself out of my depth... any help would be most appreciated--this is my ...
0
votes
1answer
25 views

Is it possible not to define category on function.php and add the shortcode [shortcode cat=1] to display the products?

I have created a shortcode called home_slider. If I use [home_slider] then I will get the slider on my page which is working. Now my concern is, Is it possible not to define category on function.php ...
0
votes
0answers
35 views

Form to add data to custom post type

I would love some help with what I have going on right now. I am new to PHP, and WordPress plugin development. I have built a very simple WordPress Plugin (following a tutorial) that takes a form on ...
2
votes
1answer
48 views

How to put an “include” inside a “do_shortcode”?

I need to put an include inside a shortcode. Can any one help me to do it, please? Example: echo do_shortcode( '[student]' . include 'incMac.php' . '[/student]' );
0
votes
2answers
52 views

Is there a plugin or way to convert shortcode to html content?

There's this plugin called media downloader, it works awesome, but I like my WordPress site to be less dependent on dynamic content. I want the shortcode's dynamic content to be converted to html code ...
3
votes
2answers
32 views

How To Ignore a Filter On Applying Filter the Content In a Function

I am having a filter for the content that adds a Table of Contents at the top of my posts. I took the basic idea from an answer at Stack Exchange itself. I add the filter as follows: add_filter('...
1
vote
1answer
49 views

Wordpress Vue Js Shortcodes

Currently i am developing a wordpress website with Vue.js and the wordpress REST API, and can't find a solution to use wordpress shortcodes ex: Contact Form 7 I have been trying this example , but ...
1
vote
0answers
21 views

Products Shortcode is Displaying Single Product Page Price for all Products [closed]

I've added a Products Shortcode to the single product page in an accordion section. The Products are displaying as expected with the relevant names, but the price shown for each is the Single Product ...
1
vote
0answers
25 views

Wordpress Shortcodes.. printf is outputting a random number… Can't figure out WHY?

As the subject states... why is this happening? I have the following shortcodes registered so that the user can easily create a slideshow within their content and widgets. functions.php function ...
1
vote
1answer
14 views

Using shortcode content with nested shortcode

This is a shortcode example. [a][b]something[/b][/a] It should be used like this with do_shortcode($content); function a_shortcode($atts = [], $content = null) { do_shortcode($content); ...
1
vote
0answers
23 views

Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?

I am trying to embed a custom WP_Query inside a shortcode I have activated on one of my pages (created in Elementor). I have a Custom Post Type called 'inspector-profiles', and for some reason when I ...
1
vote
1answer
18 views

Shortcode multiple values

This is my data (example): var obj = { something:'custom' people:[ { name:'john', age:51 }, { name:'jenny', age:62 } ] } And I use such shortcode: [...
1
vote
2answers
33 views

How can I custom order the product display?

I want to put this: [products ids="17,32,12,1,57"] And I want them to display in EXACTLY this order. Is this possible?
3
votes
1answer
20 views

Export User Info to CSV from Front End

Trying to export to CSV from WordPress front end. Here is what I have so far. I was able to export to CSV from the admin area, but for some reason I am unable to export from the front end. What am I ...
0
votes
1answer
32 views

How to add shortcode to html widget

I'm trying to include a shortcode to an html widget by adding below code to functions.php add_filter( 'widget_text', 'shortcode_unautop'); add_filter( 'widget_text', 'do_shortcode'); and to the ...
0
votes
0answers
21 views

Gutenberg running code only available in front end within shortcode

In a pre-Gutenberg site, I have a shortcode with roughly the following structure: function generate_new_member_form() { ob_start(); ?> // a form // to generate this form there is some ...
0
votes
0answers
11 views

Costume elemente not saving data

Im trying to develop my own visual composer o wpBakery element, and im having trouble saving the changes on the element i dont know why is not saving the data. this is when i save the data: and then ...
1
vote
1answer
15 views

If you add a shortcode programmatically, but the code isn't viewed on that request, is it still executed?

Is it expected behavior that the callback of a shortcode is executed even if the result isn't returned, or do shortcodes only execute when they are displayed?
1
vote
0answers
20 views

Remove shortcodes that are different (but same pattern) in each post

I have unused shortcodes in my posts like the following: [wp-imageflow2 dir=NokiaN868MP176] [wp-imageflow2 dir=Nokia6303classic97] [wp-imageflow2 dir=LGOptimus3DCubeSU87026] How do I remove them ...
0
votes
0answers
23 views

Insert HTML in content property and render it using shortcodes

I defined the following data-* attribute for a span [data-note] { position : relative; display : inline-block; margin-bottom : 1.5em; text-decoration : underline; } [data-...
0
votes
1answer
26 views

Create a shortcode for native WooCommerce search form [closed]

How can I create a shortcode for the native WooCommerce search form, so that it can be used elsewhere? In the secondary menu, for example.
0
votes
2answers
13 views

If statement shortcode

So, I am creating a shortcode to return some ACF content. The following code works: function howitworks() { $page = get_page_by_title('shop'); if (have_rows('steps', $page->ID)) : ...
1
vote
2answers
35 views

Pros and cons of actions over shortcodes

I need to output some posts on some pages and I created shortcode: function show_foo() { // output stuff } add_shortcode( 'foo', 'show_foo' ); and I use it like this in templates: echo ...
0
votes
1answer
41 views

Redirect per shortcode if user is logged in

I want to put the wordpress login screen on my homepage. If a user is not logged in I want them to have to enter their username and password into the box (or sign up).. and if they are logged in, I ...
1
vote
1answer
28 views

Make shortcode's Bootstrap CSS override the theme's CSS, how?

I'm writing a simple WordPress plugin that uses some shortcodes to show content on public side of the side. These shortcodes use some Bootstrap's components like buttons, input groups and popovers but ...
1
vote
1answer
21 views

WooCommerce Multi-Currency shortcode not working

I've installed and activated WooCommerce Multi-Currency plugin. I'm still on the free version but I with that I can add two currencies. This works fine if I try to add the widget to the footer or ...
0
votes
1answer
21 views

I want to show always 4 category boxes everytime in woocommerce

i am having problem in my website.i am using a shortcode to show a section which is show 4 rand category each time.i mean its changes each time reloads. now the problem is sometime its showing all 4 ...
0
votes
0answers
15 views

Elementor Breaks the page when custom shortcode is used

I am using elementor to design a page. When I use a custom shortcode to show few posts with featured image and author name and so on the page breaks with the error showing that "the_content" is not ...
0
votes
1answer
31 views

use value returned from shortcode as menu item

I have a menu that I created in Appearance -> Menus. One of it's items is the company phone number which is set in the theme customizer. I have a shortcode that will return that number: /* shortcode ...
0
votes
0answers
19 views

Using shortcode to implement Javascript in Elementor

Objective: To redirect users to different pages after they submit a form in Elementor. The redirection will be based on a javascript variable that is stored. I have given the submit button an ID ...