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.

learn more… | top users | synonyms (2)

0
votes
0answers
3 views

Why WP Query Multiple Shortcode not working on same page?

I created a Shortcode slider which gets ids of different pages and show display slider. Shordcode works fine but issue is that whenever i am copy past shortcode multiple times on same page/ template ...
-1
votes
0answers
7 views

Custom shortcodes for Events Manager

I've extended Events Manager plugin with a few Custom Attributes for the location, e.g. locationcategories or opening times. Now I want a shortcode for a list of all locations with a specific ...
0
votes
0answers
16 views

Adding a term to a listing inside of shortcode that otherwise contains permalinks to custom post items with custom field values

I have this shortcode to output all items of custom post type "song", on a page listing all the songs a musician released throughout his career. // Custom shortcode, to query tracklistings on the ...
8
votes
1answer
114 views

Add self-closing shortcode button to TinyMCE in WP 4.6

I'm familiar with creating self-closing shortcodes like: // shortcode function wpse_shortcode_example( $wpse_atts ) { // Attributes $wpse_atts = shortcode_atts( array( '...
1
vote
1answer
24 views

Create a shortcode to display custom post types with a specific taxonomy

I created a page template to list all products of a specific product line. Now I want to list all posts from this custom post type (products) based on the taxonomy described in the shortcode for each ...
-2
votes
0answers
8 views

Adding a expand collapse effect to a thumbnail in Wordpress

I really new into coding in PHP for WordPress and I want achieve something: I have a isotope grid, made with this plugin for wp: "wanna isotope" and I want that every thumbnail in the grid that the ...
0
votes
1answer
19 views

Search content for shortcodes and get parameters

In content I can have multiple shortcodes like [book id="1"] [book id="14" page="243"] Is there any help method with which I can search the content for that shortcode and get its parameters? I need ...
-1
votes
1answer
15 views

How get a shortcode working in category description

I want to use a shortcode for a table in a category description. It's my understanding that WP does not support this. I searched google and found some codes that i needed to add to the functions.php. ...
0
votes
0answers
20 views

How to take parameters from a function and make them editable as attributes in a shortcode

I want to make shortcodes easily editable for the user, how can I modify this shortcode: add_shortcode( 'show_news', 'news_query' ); function news_query() { $args = array( '...
0
votes
1answer
26 views

How to modify WP Query to target the first most recent post to adjust content

I'm working with a function to grab the 3 most recent posts from the category "news" add_shortcode( 'show_news', 'news_query' ); function news_query() { $args = array( 'posts_per_page' =&...
1
vote
1answer
37 views

How to make WordPress use non-greedy shortcode parsing?

I made a shortcode that can be used with or without content. However, WordPress always looks for a closing tag. This is clearer with an example: [span class="foo"] [span class="bar"] [span class="baz"...
0
votes
1answer
13 views

Query Shortcode from a multisite to appear on a different site?

So, I have a map shortcode on a page template that is used like this: echo do_shortcode('[bgmp-map]'); The shortcode works great, but I was hoping to query the site that the shortcode displays, ...
-1
votes
1answer
36 views

How do grab the main loop, with conditions, and output via shortcodes

I don't have any code for this because I'm not sure how to begin. I created a category called "News". On my homepage I want to show the 3 most recent articles, but I need to output them using a ...
0
votes
1answer
46 views

How to add attributes to a shortcode

Reading the codex, I have: function btn_shortcode( $atts, $content = null ) { $a = shortcode_atts( array( 'class' => 'button', ), $atts ); return '<a class="' . esc_attr($a[...
0
votes
1answer
24 views

Shortcode: How to add custom posts?

I am having problems with post__in shortcode atts. It does not show anything. I think the problem is that post__in must be an array but the shortcode ID returns string. function courses_shortcode($...
1
vote
1answer
32 views

Disable oEmbed for a Single Shortcode or at Least All Internal Links

Is there any way to disable the oEmbed functionality only for a specific call of the do_shortcode() function in just one script or if that is not possible can it be disabled for all the internal links ...
-1
votes
0answers
12 views

Processing multiple shortcodes in one post at once

I'm creating a shortcode that needs to access the database. I'm expecting this shortcode to be used many times per post. This means it will access the database many times. Is there a way to get all ...
-2
votes
0answers
14 views

Multiple language shortcodes in php

Im new in PHP developing ,I want my slider is with multilanguage ,and I write some little codes lines ,but these doesn't work. CODE <? if (is_front_page() || is_home()) { wpml_e__if_language( ...
0
votes
0answers
21 views

Wordpress 4.5.3: How to remove shortcode from displaying in gallery post

#gallery-1 { margin: auto; } #gallery-1 .gallery-item { float: left; margin-top: 10px; text-align: center; width: 33%; } #gallery-1 img { border: 2px solid #cfcfcf; } #gallery-1 .gallery-caption { ...
0
votes
1answer
23 views

Help With Creating Shortcode

I'm looking for a way to check just check for an option existing when executing a shortcode, but that option doesnt need a value. How do I just check for JUST an option? For example I tried this out, ...
-3
votes
0answers
29 views

How can I edit a woocommerce / visual composer shortcode?

There's this element in Visual Composer: Product Category, which retrieves all products in a specific category. I would like to know where can I edit it, so I can modify its HTML output.
-2
votes
0answers
15 views

How to make woocommerce looping images of one product in the content-product.php

I need to put via woocommerce shortcode 'product' a product, and it must to change image (second image of product) when hover.There is the code of content-product.php: <?php if ( ! defined( '...
0
votes
0answers
15 views

Use Shortcode to pull specific custom post type into any page

I'm looking for a way to code a shortcode like [shortcode slug="slug-name"] that will pull data from the slugs specific custom post type and fill the variables of my template that I'm attaching or ...
0
votes
0answers
17 views

How to escape content of enclosing shortcode the right way?

What's the right way of escaping the content of an enclosing shortcode without messing enclosed (self-closing) shortcodes up? [my-enclosing-shortcode] [some-self-closing-shortcode foo="bar"] [...
0
votes
1answer
33 views

using a shortcode in a hyperlink

I am trying to use a shortcode inside of a hyperlink <a class="wpb_button_a" title="Reserve Now" href="/reservation/?unitrate=[print_csv position="5"]&amp;unitsize=5%20X%205&amp;...
0
votes
0answers
20 views

How can I get post meta data (custom field) from within a custom wordpress action hook?

I have a custom hook in my theme which is set up like this: do_action('my_custom_hook'); That code is in my header.php file and outside of the main loop. I have a call to this hook like so in my ...
0
votes
0answers
16 views

wp_query query with two custom posts shows all post instead of matching ID

I have two types of custom posts - a "neighborhood" and an "area". Either of these can belong to a "base". When I am querying just the "neighborhoods", the base page has no issue pulling up the right ...
0
votes
1answer
41 views

Persistent Shortcode Attribute Variables using WP_Query and WP AJAX

I'm trying to: list posts using a shortcode using WP_Query have that list use pagination have that pagination use AJAX ...and - where I'm getting stuck - manipulate my list via shortcode attributes ...
4
votes
2answers
81 views

How can I put a wp_redirect into a shortcode?

I have a typical shortcode which prints some html on a page. The shortcode will only be used on pages where visitors are logged in. As a separate operation, I've been using a custom field to trigger ...
0
votes
0answers
12 views

Getting Custom Attachment Meta Data from Custom Media Manager

I have a custom shortcode button which opens the media manager and allows you to insert an image into the post: (function() { var file_frame; tinymce.create('tinymce.plugins.customButtons', { ...
0
votes
0answers
32 views

Pass Variable from Function to Shortcode

I realize that this may be as much of a PHP issue as a WP issue, but I'm posting it here because it does pertain to shortcodes and have some WP-specific functions mentioned. Basically, What I'm ...
0
votes
1answer
55 views

Shortcode to eliminate <p> and replace </p> with <br>

I have a filter that removes opening p tags and replaces closing p tags with a br tag sitewide. The client would like this filter in a shortcode that they can use only on specific portions of the site....
0
votes
2answers
42 views

Running Filter or Shortcode Before Query Prevents Excerpt from Showing

I've been wrestling with some code cobbled together for a function I found, first published circa 2009 and my inexperience with PHP has me at a loss. The function is designed to count episodes in a ...
0
votes
1answer
28 views

Shortcode call not working in WP Template

I'm working with a Visual Composer shortcode to call a text resizer into being. When using the Visual Composer or the classic WYSIWYG, if I insert it's shortcode [enlarge_text small='A' ...
0
votes
0answers
17 views

Generated short-codes don't seem to work

I'm using "Photo Gallery" plug-in and W3-data. Then there is a page where I want to display one gallery (of photos) per user. So using w3-data I generate the short-codes that I would like to have ...
0
votes
1answer
20 views

Object of class WP_Query could not be converted to int inside shortcode

I have the following code which is used to display download posts by the custom taxonomy. I am receiving the error Object of class WP_Query could not be converted to int When I have Query ...
-2
votes
1answer
29 views

Can I prevent wordpress adding <p> and <br> tags to autoembeds

Cant give a reduced code example right not because my Advanced Responsive Video Embedder plugin is somewhat complicated. But the exact same code is used to generate the embeds, its just through ...
2
votes
0answers
23 views

Remove and restore one shortcode

I would temporarily remove a shortcode, make something and restore it... it's possible? // override default wordpress "the_content" hook remove_filter('the_content', 'do_shortcode', 11); add_filter('...
0
votes
1answer
69 views

stop Wordpress removing shortcode from content [closed]

I've found that Wordpress is removing &nbsp; from my content, so from this page, I added the following to my functions.php: function nbsp_shortcode( $atts, $content = null ) { $content = '&...
0
votes
1answer
42 views

Automatically add class-attribute to gallery?

I'm making a theme for a client in WordPress and he wants each gallery to have a grouped lightbox, so there's a lightbox for each gallery. I found out you can make it add an attribute to the gallery ...
0
votes
2answers
32 views

What is the correct syntax to append a URL using a shortcode for an iframe?

I need to iframe a series of content on our site. I need to pass on the the user information via a URL - vendor request. I have tons of shortcodes that display the username. It works fine. But ...
0
votes
2answers
35 views

Custom Field 101

I'm trying to learn how to use the Custom Field function. I have a series of posts with titles like "Adams County," "Lane County," etc. All are in the category "Washington" and are tagged with "county....
0
votes
2answers
70 views

Shortcode is not outputting all of the desired markup

I'm having trouble getting my shortcode to output all of the markup - for some reason it's only outputting part of it. I have the following function: function shortcode_container($atts, $content = ...
3
votes
1answer
55 views

Stop strip_shortcodes() stripping content inside shortcodes

I have this shortcode: add_shortcode('refer', function($atts, $text) { $defaults = ['link' => '', 'nofollow' => true]; $atts = shortcode_atts($defaults, $atts, 'refer' ); $...
0
votes
3answers
60 views

custom field (video/audio url) and embed functionality

I was wondering if there is any way to combine a custom field (in custom post type) with an embed shortcode? Long story short - a user type into a field called videox and an url for a video (youtube, ...
0
votes
3answers
53 views

Wordpress shortcodes & performance

Do shortcodes affect performance? each plugin using this technique has to parse post/page content looking for the shortcode? If so, it would be better to limit as much as possible shortcode-based ...
1
vote
1answer
26 views

Setting youtube size in functions.php

I'm using the code below to set the width and height of youtube embeded links ////////////////////////////////////////////////////////////////// // Youtube shortcode //////////////////////////////////...
0
votes
0answers
19 views

Turn shortcode into HTML view right after the user types it in the admin editor

WordPress automatically embeds from many providers. Let's say I type an URL from YouTube in the admin editor, it instantly shows the video at "Visual" tab, the iframe embed, but the URL remains ...
6
votes
2answers
208 views

Insert Custom HTML After Shortcode

The scenario is that I need to add an HTML banner under a slideshow which is a shortcode in the homepage content. I personally hate adding a bunch of div tags to the TinyMCE editor so I'm trying to ...
0
votes
1answer
30 views

Shortcode outputting at top of content

I have a shortcode that is always outputting at the top of the page content. I am not sure on the correct usage for the output buffer in this instance. Below is my shortcode function: function ...