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
12
votes
1answer
2k views

Custom media upload content for inserting custom post shortcode

I’m working on a plugin that creates custom post type “portfolio” along with shortcode to insert in any page or post. The shortcode is: [portfolio option1=“1” option2=“0” option3=“1” ] And it works ...
0
votes
1answer
475 views

post/page content

I am trying to insert a post/page into one of my themes files and it won't display shortcodes or PHP. I have created a page called home in the wordpress admin-paned and inserted into my code the ...
0
votes
1answer
27 views

Custom Post type shortcodes

I create a custom post type (features) in my theme with Advanced Custom Field. I want to know how i can create a shortcodes of my custom post type. so that i just used a shortcode of that custom post ...
-1
votes
0answers
13 views

Custom post type shortcode [duplicate]

I create a custom post type (features) in my theme with the help of advanced custom field plugins. I want to know how i can create a shortcodes of my custom post type. so that i just used a shortcode ...
0
votes
1answer
15 views

Shortcode conflicts

My plugin provide shortcodes like this: [cfgeo return="city"] - returns city name [cfgeo include="us"]Text only seen in the US country[/cfgeo] - returns this text only from the visitors in the US. ...
0
votes
1answer
8 views

Slider Revolution - Uncaught ReferenceError: setREVStartSize is not defined

I am working on WordPress 5.2.2 running php 5.6.30. I was using slider revolution 5.4.8 previously which was being displayed via the shortcode however the Animations were not working I did try several ...
0
votes
0answers
8 views

How to keep the selected language when changing the menu bar or page Polylang code snippet [on hold]

I have an issue with Polylang plugin. When i am at home page i choose the language( example English) which it does translate it but when i go to the other menu bar (example Contact or About Us) it ...
0
votes
0answers
12 views

How Would I add WooCommerce Brands plugin to filter with Woo search filter plugin? [on hold]

How Would I add WooCommerce Brands plugin to filter with Woo search filter plugin? Trying to get the brands to be a multiple filtered option but so far all I’ve figured out is the short code to get it ...
0
votes
0answers
14 views

Checkbox boolean always returning false in WPBakery [closed]

I've created a custom element for the WPBakery plugin. I have mapped out a simple checkbox for this element: array( 'type' => 'checkbox', 'heading' => esc_html__( 'Add box shadow?', '...
0
votes
1answer
11k views

Add custom attributes to a post

My blog is mainly composed of posts describing hiking. Actually, since I just moved from a Wordpress.com blog to a self-hosted Wordpress blog, every hike is inserted in a simple post. However, every ...
0
votes
1answer
20 views

How to pass multiple custom fields as shortcode's parameters

I'm learning how to pass parameters in shorcode, I know the basic step after read through WP Codex. But for now, I have plugin come with custom fields and as the title, I want to know how to do it. ...
-2
votes
1answer
28 views

Creating a shortcode with a variable (Woocommerce)?

I'm new to PHP. I want to create a shortcode that outputs a user's order number, but I'm having trouble. All I know is that the order ID variable is "$order->get_id();"
1
vote
1answer
411 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
0answers
20 views

wp.blocks.registerBlockType not showing what I want on the frontend

According to my understanding, whatever is displayed in the save: function is what is shown on the page in the front end? So I am trying to query the database from my block to get information I am ...
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 ...
0
votes
2answers
488 views

Adding json as params to shortcode

First apologies if this is a stupid question I can imagine there is an easy way to do this but would like to ask anyhow. I have setup a js framework that I am trying to integrate into a WordPress ...
0
votes
1answer
466 views

get shortcode value

I created a text field in a shortcode for highcharts where we can choose a footer label for the chart. This is the field: array( 'label' => esc_html( 'Footer label' ), ...
0
votes
0answers
18 views

How to Convert Shortcode to Static content?

Shortcodes are executed dynamically, but that makes the search not work within the shortcode content. I have also tried relevanssi search. Now I would like to convert that shortcode dynamic content ...
3
votes
1answer
2k views

Customizing gallery shortcode in 3.5

I'm trying to customize the gallery shortcode using the new gallery system in 3.5 and I'm having a bit of trouble and can't figure out where I'm going wrong. This is what I've got at the moment (in ...
1
vote
1answer
1k 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 ...
0
votes
0answers
10 views

Controlling site wide modules from one place in the backend

I'm building pages using the WPBakery plugin. I've created custom elements for all of the building blocks, but there are two elements which appear across all pages, those being: Get in touch banner ...
0
votes
1answer
531 views

Get shortcode attribute value to another function

I am trying to get shortcode attribute value to another function to add inline style.I want to use $color's value to another function. Here is my code <?php /** * */ class MakeShortcode { ...
0
votes
0answers
39 views

Displaying a Category on a Wordpress Page

I have a game.php file and all main categories are displayed there with a shortcode. output results by category. Question. You don’t need to output in category.php so that I don’t throw it on category....
0
votes
0answers
19 views

Multiple Video Shortcode in tabs show One video in all places

I have multiple tabs on a single page. In those tabs I have added different videos and saved them. When I go to the front side, only one video is showing in all tabs: the first one. [video width="...
0
votes
1answer
26 views

How do you stop a shortcode from firing in the editor?

I created a custom short code that includes creating an on page table along with a few other things. But the short code is loading in the editor as well, and it is causing errors and preventing me ...
0
votes
0answers
20 views

Custom post type shortcode with taxonomy attribute not working and no errors

I have the following code to display posts with a custom taxonomy but it's not working. It just displays all the posts: // Add Shortcode function custom_shortcode( $atts ) { $atts = ...
0
votes
0answers
27 views

Show number of products in page - WooCommerce

I'm trying to accomplish the following scenario: Show the number of products based on category and when applying filters then dynamically change the count of products on that page. I'm using the ...
1
vote
1answer
396 views

Wordpress Shortcode callback function with a plugin

I am working on a plugin and the plugin currently works great on the admin section but I'm trying to extend the functionality to the front end and using a shortcode to use the same functions. I have a ...
0
votes
2answers
422 views

Theme Convert PHP code to shortcode

My theme uses this code which I am trying to convert to a shortcode so I can use on custom templates: <div class="x-breadcrumb-wrap"> <div class="x-container max width"> &...
0
votes
0answers
18 views

How to display a post(by id) along with css in a page?

I am curious if it's possible to get a post content along with its CSS (say if button background color is green on the post) and display it a page? I am able to get the content but the CSS are not ...
0
votes
2answers
406 views

Load scripts for do_shortcode( ' [ my_shortcode ] ' )

I want load some scripts and style only for a specific shortcode. I used if ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'my_shortcode') ) {} It works when I put my ...
0
votes
0answers
15 views

How to find out shortcodes code in a page set in custom layout page template?

I tried to migrate a website to another hosting. The site is use videotouch theme. The front page is a page which is setup with shortcode plugin for custom layout with template. Because of category ...
0
votes
0answers
41 views

Shortcode to output category description by passing ID

I have this shortcode function: function category_description_output($atts) { $atts = shortcode_atts( array( 'catID' => '16' ), $atts, 'categorydescription' ); return ...
0
votes
1answer
23 views

Do I need to escape number in this shortcode function?

This is the function: function shortcode_output($atts) { return do_shortcode('[ks_tab col="'.$atts['num'].'"][/ks_tab]'); } add_shortcode( 'my_shortcode', 'shortcode_output'); People would add a ...
0
votes
0answers
23 views

How to wrap pattern-matches from the_content in [wiki]-shortcode tags

I'm working on a function to wrap word-matches* in [wiki]-shortcode tags. I suspect the best method is to use add_filter() on the_content, and parse using RegEx in preg_replace_callback_array(), but ...
-1
votes
1answer
466 views

If YITH Wishlist page is set to the WooCommerce my-account endpoint, the endpoints stop working all together. Any solution?

When using YITH to display the wishlist in the my-account endpoint of WooCommerce, the wishlist works fine, but the endpoints stop working. If we change the page to anything else other than the my-...
0
votes
1answer
422 views

Change the default video URL in a post to shortcode format

I want to add video from youtube/vimeo to my post.Whenever i add a video to my post ,there will display a link like https://www.youtube.com/watch?v=dsUXAEzaC3Q in my admin(Add new post ),and in the ...
0
votes
0answers
18 views

How to use products shortcode in taxonomy-product_cat with multiple columns?

I have a custom taxonomy-product_cat file and need to show some products by shortcode. but it show products just in one column!!! I tried many product shortcode but same results! $sc="[products ...
0
votes
2answers
523 views

Creating custom shortcode

I'm trying to create some custom shortcode - I want to be able to have names and numbers of people I want to display on my website, but as a shortcode, so it doesn't have to be typed in again and ...
1
vote
1answer
412 views

esc_attr not working in shortcode

I have a shortcode that outputs a block of html. One element in the block is an anchor tag with an image caption in the title attribute. Some of the captions I am using have double quotes in them, so ...
1
vote
2answers
415 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: &...
-1
votes
1answer
22 views

Shortcode Attributes - post__not_in array

I'm trying to put together a shortcode that let's the user loop posts but exclude specific ones by id. $atts = array_change_key_case((array)$atts, CASE_LOWER); // override default attributes ...
0
votes
0answers
34 views

Using <!--nextpage--> within a shortcode

Here's one issue I am currently trying to solve and it concerns using <!--nextpage--> within a shortcode. I'm developing a plugin using a shortcode (unfortunately I don't have any URL to share ...
0
votes
0answers
38 views

Why isn't working WooCommerce session inside shortcode?

Hope you're doing great! I am trying to print the WC()->session->get inside a shortcode but getting error , bellow is my code and error function set_session(){ global $woocommerce; WC()->...
0
votes
1answer
461 views

Display tags cloud from a specific category ID with a shortcode

I'm trying to display some tags cloud in different locations of my Wordpress. I'm using a shortcode but I'm looking for a way to display only the tags from a specific category ID by adding this ID ...
0
votes
2answers
508 views

Pass fileurl parameter into shortcode from Advanced Custom Fields

I'm trying to create a custom shortcode that uses another shortcode for a couple audio players on a Grid displaying a custom post type using Visual Composer. The audio player that I would like to ...
1
vote
1answer
581 views

Remove 'p' tags around shortcodes and 'img'

I'm having trouble removing paragraph tags from around shortcodes. I've tried this solution without success. How to to stop html editor from addig <p> tags to shortcodes, images, etc and this ...
0
votes
1answer
17 views

add_shortcode is not working in plugin where others are working

I have the following really simple code: function load_peoplesoft_results() { global $wpdb; echo "<h2>Results</h2>"; } add_shortcode('load_peoplesoft_result_page', '...
0
votes
2answers
20 views

How to set up posts per page on WP

I add this code on my website [display-posts image_size="thumbnail" wrapper="div" wrapper_class="display-posts-listing grid" meta_key="_thumbnail_id" display-post category="<code>...