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
0answers
6 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
1k views

WP_Editor Shortcode Issue

I have created a front-end editor using wp_editor that functions as it should. Upon testing I have noticed that it is stripping out any shortcodes that have been inserted in the content. I have ...
0
votes
1answer
789 views

Database Queries Optimization with new WP_Query

I’m building (mostly with a self-teaching purpose) a simple plugin to query posts from another blog on a MS network via a shortcode (like [network-posts blogs=”8" layout=”grid” columns=”3"]), but I’m ...
0
votes
1answer
695 views

Executing Javascript in Plugin

I am trying to display a google map using short code for a plugin I am building, but I can not get it to work. Does anyone have some advice on this? Here is my code: add_shortcode( 'show_map', array(...
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
2k views

Create shortcode in Child Theme?

I have created a child theme, and I am trying to add a shortcode to its functions.php file, by doing this: // functions.php of child theme <?php include(WP_CONTENT_DIR . '/graduates_functions....
1
vote
1answer
837 views

Video Shortcodes not working in Wordpress

I have my own wordpress theme created, when I attach a video to the post it looks good while editing. After posting the post, showing the post comes out the following code but does not display the ...
0
votes
1answer
31 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
819 views

shortcode tags not working in do_shortcode

I'm creating a shortcode as part of a plugin that I'm calling in a template like this: do_shortcode('[shortcodename title="monkeys"]'); The function looks like this to begin with: function ...
2
votes
1answer
702 views

Shortcode displays only default attribute values

For some reasons every shortcode, that I try to add to functions.php, displays only default attribute value and ignores what I specify in a post. E.g.: function my_shortcode( $atts ) { extract( ...
0
votes
1answer
27 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
1answer
1k views

How to add a shortcode to an HTML image tag

I want to add a timestamp to use as unique id for conversion tracking. I have a [[timestamp]] shortcode on my site. In text it works fine, but the shortcode does not work when placed inside the src ...
1
vote
1answer
1k views

Get custom taxonomy for visual composer shortcode but not working?

I created a shortcode for visual composer to get terms of a custom taxonomy. But when I get them (for a category dropdown on visual composer's backend editor) it's not working. My code: $args1= ...
0
votes
2answers
781 views

Get post content from outside the loop with plugin shortcode usability

This is great for showing just the raw content... Get post content from outside the loop But i'd also like to apply shortcodes from various plugins to my content to affect the content. What would I ...
0
votes
1answer
554 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 ...
2
votes
4answers
2k views

How to detect if a Shortcode is being called on a page?

I'm trying to push some variables to google analytics and would like to be able to detect if a shortcode has been included on a page at all. Anybody know a smart way going about this? Thank you! ...
0
votes
3answers
3k views

Woocommerce products shortcode specific order

Is there a way to get products in the order of the IDs in the shortcode parameter: e.g [products ids="53,68,1"] Display block with 3 product, where 53 on first place, 68 on second...? Now I get ...
2
votes
2answers
1k views

Search & Remove Specific Shortcode From All Posts

Question Is there a way to remove a specific shortcode, say [print_me] from all the posts where it appears in one shot. And I don't mean mask it or filter it so it doesn't show up while it stays in ...
0
votes
1answer
969 views

Change the default video shortcode

When I select a video file from media library and click on insert in to post button that time it goes like this : [video width="1280" height="720" mp4="https://s3-us-west-2.amazonaws.com/bucketname/C-...
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
2answers
1k views

Push Shortcode parameter to template

I'm trying to push a shortcode parameter value to a template file but for some reason I can't get the array value that I'm targeting into a single variable. Here is my code and the shortcode I'm using:...
1
vote
1answer
430 views

How create a Shortcode with hover and complex options

I am wondering how do you do when you have to create a shortcode with multiple hover or complex options ( gradient, boxshadow etc, thing that can't be inline ). How do you generate the css. I don't ...
1
vote
1answer
998 views

Replace shortcode in substring

I've created these two functions to toggle between the first paragraph of the content and then everything but the first paragraph so when the user selects 'More' it slides out the article smoothly ...
0
votes
2answers
469 views

Multiple do_shortcode($content) within one shortcode

TLDR; How can I run a shortcode with multiple shortcodes inside of it? I'm trying to run a shortcode with multiple shortcodes inside of it. I can successfully run a shortcode with one shortcode ...
2
votes
1answer
909 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 (...
1
vote
2answers
1k views

Display post metadata: “title, category, author, date” with shortcode

How to create shortcodes to the standard post-metadata "title, author, category and date" in order to display it in post-content? E.g. post-content including shorcodes: Lorem ipsum dolor [post_title]...
0
votes
1answer
36 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?
2
votes
1answer
989 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 ...
1
vote
3answers
549 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: &...
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 ...
55
votes
8answers
38k views

Enqueue Scripts / Styles when shortcode is present

What is the idea way to register/enqueue scripts and/or styles for use in plugins? I recently made a plugin simple plugin to add the user avatar/gravatar with a shortcode. I have different style ...
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
454 views

ob_get_clean(); doesn't return $value in shortcode?

i using this code: <?php ob_start(); echo '<div class="judul"><h3 style="text-align: center;"><strong>Download <?php echo esc_html( $judul ); ?> Batch Kumpulan Subtitle ...
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
36 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 ...
1
vote
1answer
2k views

Pass php dynamic variable to shortcode

I am not sure if there is a simple solution to my problem. The requirement looks simple but unable to find answer even after breaking my head for 6 hours. I have to pass variable from a php function ...
1
vote
1answer
240 views

How to set Contact Form 7 fields default value using shortcode attribute? [closed]

The contact form 7 plugin provides an option to set the default value of a form field using a shortcode attribute (as documented here). This can be useful to dynamically change the recipient of a ...
1
vote
1answer
448 views

How to Reference/Echo Variable from Another PHP Function

I have successfully set up a PHP function for my blog posts to create a shortcode to automatically display/style an iFrame tag for a YouTube video, as well as pull in the duration and view count ...
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
1answer
5k views

Create category post shortcode

I'm trying to create a shortcode for my theme without using plugins. I tried this http://wpgeneratetool.com/short-code/ but i can not figure out how to create. I want to create something like the ...
0
votes
2answers
2k views

Insert wp gallery shortcode into custom textarea

Is there a way to insert wp gallery shortcode into custom metabox textarea ? I would like to have something like this: New metabox in post/page with textarea and below textarea there are a button to ...
1
vote
1answer
4k views

Get page content and execute shortcodes on a page

I would like to get show multiple page's content on one page with shortcodes. If I use return $html; the shortcodes not working, if I use return do_shortcode($html); the shortcode working, but the ...