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.

742 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
1 answer
143 views

Can I create customizer setting that can handle plugin shortcode?

Can I create a customizer setting which will handle a shortcode from a plugin? Do I violate and rules or guidelines in WordPress theme development? If it's possible what is the best way to sanitize ...
user1645213's user avatar
4 votes
0 answers
103 views

Can I strip HTML tags in the "Compare Revisions" screen?

I am building a CMS for content editors that have zero tech savvy. They currently use a system called NewsCred that allows them to compare revisions much like how WordPress does when you visit /wp-...
Cory Fischer's user avatar
3 votes
1 answer
94 views

Changing a function in function.php to a shortcode - for listing categories of only a certain post type

I'm trying to create a shortcode that can display a list of categories. However, it should: First, limit the results to a specific post type (based on shortcode usage) then check to see if category ...
Tako Bubble's user avatar
3 votes
0 answers
360 views

How to fix wrong attribute error for Visual Composer Grid Builder?

Hello I am facing this issue in editing media grid layout of Visual Composer V6.2.2. Below is the error I am getting Fatal error: Uncaught Exception: Wrong attribute for 'vc_single_image' shortcode. ...
Ashish Jat's user avatar
3 votes
1 answer
2k views

Shortcodes not working in an AJAX call

I am using AJAX to load next set of posts on homepage. The posts load fine but the shortcodes are not rendered. I am trying to use the do_shortcode function on the content the ajax call fetches (...
JMDee's user avatar
  • 31
3 votes
2 answers
392 views

Calling shortcode in wp_localize_script strips result

I am working on adding some functionality on a Wordpress plugin which after a certain click needs to call on some shortcode through ajax. What I first attempted was to call the shortcode inside of ...
thairish's user avatar
  • 213
3 votes
0 answers
90 views

Tinymce shortcodes within shortcode contents

I am using wp.mce.views.register to create a simple view for my shortcode in the tinymce editor, this works fine but i am looking for a way to have "nested" shortcodes e.g. [column_3] [info_box] ...
Marcus Rognes's user avatar
2 votes
0 answers
468 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 ...
Barry Chapman's user avatar
2 votes
0 answers
36 views

Looking for a solution - slightly convoluted problem

OK so stick with me on this one... it's a little involved. I won't describe it all, I'll simplify things as best I can to the basics. OK so, on my wordpress site I have three text boxes (BOX1,BOX2,...
nirurin's user avatar
  • 121
2 votes
1 answer
25 views

Can't get custom posts of taxonomy to show

I have a custom post type called 'brand', with a taxonomy of 'brand-categories'. try as I might, I cannot find a way to display a list of posts in the current taxonomy. can anyone help? <?php ...
Captain Dando's user avatar
2 votes
2 answers
3k views

Wordpress shortcode doesn't working on HomePage

What I want to do is make my Home Page. I can do it this way: Create a page and insert my gallery from plugin with that code [wonderplugin_gridgallery id=1] Set that page as HomePage. BUT THAT IS ...
Sergey Kiziev's user avatar
2 votes
0 answers
72 views

Wordpress 4.7 Galery shortcode not working

my gallery shortcode is working wp 4.00 version but ı upgrade wp.4.7 not working how can i fix . why not working ? when i delete this function ,normal wp shortcode function not working . this is my ...
Onur Güngör's user avatar
2 votes
0 answers
67 views

How to make shortcode output display where I choose

There are tons of post about this, but in my case, i see no echo(so i can change for return) in the shortcode.php file of the plug in, i did not developed this plug in, i need to fix the problem that ...
Hacedores de Discipulos's user avatar
2 votes
4 answers
2k views

Can I use a Shortcode output as an HTML attribute value?

Within a span, the shortcode output works: <span>[sola_testimonials_count type='all']</span> Result: <span>5,205</span> But as an attribute value, it doesn't get parsed: &...
Hairgami_Master's user avatar
2 votes
1 answer
545 views

WP theme with Backbone

What would be the best way to insure that a Backbone WP theme cooperates with standard shortcodes and other WP plugins that include script and style tags in header and footer. I know Backbone plays ...
steakoverflow's user avatar
2 votes
1 answer
1k views

Can A Shortcode Get HTML/Text From Content And Return It Twice With Added HTML?

I'm trying to cut down on some work for myself and I was hoping someone might know if this is possible. These are images setup in a slider that shows a text overlay on the image on the next slide in ...
DRK's user avatar
  • 29
2 votes
0 answers
666 views

Is it possible to delay execution of shortcode output callback?

I have a problem : shortcode output callback triggered too early. /* Defined in plugin constructor */ add_shortcode( 'foobar' , array($this,'pre_render_routine')); function ...
Ivan Varlamov's user avatar
2 votes
1 answer
204 views

Processing shortcodes in groups (separated by line breaks)?

The Project I'm working on a plugin to resize and embed rows of images using shortcodes that will be converted into <img> tags. In most cases there will be multiple images per row, and the ...
Austin's user avatar
  • 121
2 votes
1 answer
49 views

Wordpress auto adds p to shortcode parameters

Wordpress auto adds p tags around shortcode parameters. Is there any way to stop this ? function minimum_working_example ( $atts, $content ){ extract(shortcode_atts(array( 'html' => '',...
Roukanken's user avatar
1 vote
1 answer
55 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 ...
learningtech's user avatar
1 vote
0 answers
31 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 ...
Luis A. More's user avatar
1 vote
1 answer
278 views

How do you export and import wordpress blog posts and exclude pagebuilder shortcodes?

I am exporting wordpress blog posts from one website and importing them to another wordpress website. Unfortunately, the blog posts are including page builder created shortcodes from the old website. ...
Wes's user avatar
  • 11
1 vote
1 answer
263 views

How to handle Ajax Calls, when using same shortcodes (with different parameters, e.g. 'post-type')?

this is my very first question here. So please don't be too angry, if I miss something out or make mistakes while using the plattform. I was, of course, trying to find an answer on my problem first. ...
Diddi_83's user avatar
1 vote
0 answers
355 views

Wordpress Shortcode to get URL Parameters $_GET['name'] redirects for no reason at all

Need some help in understanding how does WordPress Redirects work. While working with shortcode: add_shortcode('name', 'get_name'); function get_name() { return $_GET['name']; } The page which ...
User 29449's user avatar
1 vote
0 answers
59 views

Taxonomy Order by Name

I created this shortcode to display my custom taxonomy terms: add_shortcode( 'taxonomy_lists', 'wptls_taxonomy_lists' ); function wptls_taxonomy_lists( $atts ) { $atts = shortcode_atts( array( ...
Monica Maria Crapanzano's user avatar
1 vote
1 answer
27 views

Where to filter Shortcode string prior to execution

Whatever WP function assembles the $att array from the [myShortcode att1="..." att2="..." ...] string uses the " character to delimit the data. However, the “ and the ” ...
jcropp's user avatar
  • 111
1 vote
0 answers
367 views

Wordpress load same script two times

I write a basic plugin with custom css/js. I use wp_enqueue_script for my custom script and use hook 'init' to register script in front-end page. But wordpress load this javascript file two times with ...
tecnico57's user avatar
1 vote
2 answers
177 views

Adding to the_content or a variable from within a shortcode function

I've created a custom shortcode to add pop-up definitions to selected vocabulary terms. The shortcode looks like this: [glossary term="data breach"]data breaches[/glossary] The function ...
BoyKenan's user avatar
1 vote
0 answers
135 views

How to add AJAX in a custom PHP function using Google sheets API

I have followed a website link to fetch data from a SINGLE CELL of a Google sheet to a shortcode. And I am using that shortcode into the COUNTER widget in Elementor to achieve counting animation while ...
Zohaib Ahmed's user avatar
1 vote
0 answers
484 views

Get Required Assets (JS, CSS etc) for post using REST API

I'm using the REST API to access WordPress data and publish it on a custom frontend as part of an integration. This works great because the shortcodes are parsed and rendered by WordPress so the ...
Jason's user avatar
  • 11
1 vote
0 answers
37 views

WordPress function not being called from jQuery method

I’m very new to WordPress Plugin Development. I’ve been learning and developing my plugin for around 2 weeks now. My plugin is supposed to be a retrieve a question from the WordPress database and ...
ari2010's user avatar
  • 11
1 vote
1 answer
220 views

Shortcode To Display Post Custom Field Value Inside Excerpt

I want to create a shortcode that pulls value from a custom field of a post and returns that value inside excerpt. I already have a function for the custom value: function geo_name_function( $atts ) { ...
Discover's user avatar
1 vote
0 answers
37 views

shortcode in snippet plugin not work

add_filter( 'woocommerce_product_tabs', 'wpb_new_product_tab' ); function wpb_new_product_tab( $tabs ) { // Add the new tab $tabs['test_tab'] = array( 'title' => __( 'Size ...
Noam Yakov's user avatar
1 vote
0 answers
24 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 ...
shelbypereira's user avatar
1 vote
1 answer
3k 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="' . ...
dragoweb's user avatar
  • 249
1 vote
1 answer
66 views

Missing image in gallery shortcode in custom feed

I have problem with custom gallery shortcode and missing first image in each gallery block. For example: [gallery ids="1,2,3,4,5"] show only 2,3,4,5 pictures. This custom shortcode is part ...
Nar's user avatar
  • 11
1 vote
1 answer
53 views

How to exclude category ID from Looper in Wordpress

I'm trying to exclude 2 (and potentially more) ID's from my loop, that displays all categories that have posts. The category ID's i'm currently trying to exclude are 1 and 19. I'm very new to PHP but ...
Johan Schack Petersen's user avatar
1 vote
0 answers
255 views

Shortcodes — Using add_action, add_filter in the shortcode

A client wants the following: User clicks on a specific button which takes them to a partner's site. If this is their first time clicking the link, they need to accept terms and conditions. If they'...
Tomasch's user avatar
  • 31
1 vote
0 answers
29 views

Add a specific part of current category page url to shortcode

I have the following URL: website.com/category/xyz, where xyz can be hundreds of different words. I use a table plugin for displaying my content all throughout the website, and I want it to filter me ...
KrisV's user avatar
  • 11
1 vote
0 answers
570 views

How to display data from custom table in wordpress phpmyadmin

Thanks in advance could anyone here help me, I would like to display the value from the phpmyadmin database in wordpress, The value was stored from the dropdown form and I want display that value in ...
Siddheshwar Chavan's user avatar
1 vote
0 answers
19 views

Calculating a large number of MYSQL queries as customshort codes, slow

I am using wordpress and building a dashboard. There are a lot of complex MYSQL queries that I am running in order to return results from the DB. I am returning these as custom short codes in ...
Mikey's user avatar
  • 11
1 vote
1 answer
2k views

How do I display "Hello username" if logged-in on the homepage

I am trying to show the name of the currently logged-in user in a small text like 'Hello, username!'. I tried to do this, but it doesn't work: <p class="vam"> <?php if(...
user195982's user avatar
1 vote
1 answer
2k views

How to add an automatic refresh in Wordpress for a Page/Post or an embedded OneDrive/Excel HTML Code?

I have added an embedded Excel sheet on my website's home page. It is always displaying live data which is changing all the time. But when me or my colleagues view that page, they need to refresh the ...
user avatar
1 vote
0 answers
3k views

shortcode to display woocommerce cart total

I just hit a stumbling block. I'm currently using the <?php echo WC()->cart->get_cart_total(); ?> function to output the price of the products in cart. However, the resulting output was ...
user3733346's user avatar
1 vote
0 answers
22 views

Orderby is working with one query but not with other

I'm using a shortcode to show some price boxes. I use a CPT with a custom field called 'posicion' which has a number that I use later to customize the loop. This is the code: <?php if ( ! defined( ...
Alex's user avatar
  • 11
1 vote
0 answers
295 views

How to force that styles are enqueued in the header?

I have a plugin processing a shortcode, that needs specific styles. For this I used wp_enqueue_style. As I just need to enqueue the CSS upon certain parameters of the shortcode, I call ...
humhum's user avatar
  • 11
1 vote
1 answer
31 views

Making a Template for a CPT created by a plugin

Good day, I'm currently working with a new plugin which creates a custom post type for different rooms and I'm trying to create a custom template using Toolset, but other content is automatically ...
Cullen Carstens's user avatar
1 vote
1 answer
567 views

Shortcodes not working in category or tag description

when Yoast plugin is enabled shortcodes not working in category or tag description I used this and this article and add these codes to the function but nothing change please help me. add_filter( ‘...
D.JCode's user avatar
  • 201
1 vote
1 answer
41 views

Wordpress shortcode for a section Template

I have made a Section Template called section-bachelorscholarships.php in the Folder frontpage in the Theme Folder and I have put this Code <?php while ( have_posts() ) : the_post(); ?> ...
Ahmad Al Hariri's user avatar
1 vote
0 answers
21 views

Populate shortcodes with table data and get next row

Let's say I have a database table wp_myplugin_cars that looks like this: id name color make -- ---- ----- ---- 1 Peter Red Ford 2 Jo Blue Nissan 3 Brian Silver ...
Warren's user avatar
  • 111

1
2 3 4 5
15