Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
20 views

extra comma is appearing after shortcode attribute while creating custom gutenberg block

I have created a Gutenberg block which returns shortcode in RawHtml component but while returning dynamic shortcode in edit() function it gives extra commas appending in the shortcode, can anyone ...
0
votes
1answer
14 views

wp_editor not rendering the shortcode

I have created an options page and have added wp-editor input in that. While rendering the output of that, it doesn't render the output of shortcodes added into it. It just renders shortcodes as text. ...
2
votes
1answer
34 views

Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

My client's website is moved from http to https, and I have updated most of the URLs using queries in phpMyAdmin, but I have been unable to update shortcode URLs. I have used the following query to ...
0
votes
1answer
23 views

How to Enable embedding Wordpress default gallery in comments?

I want to embed WordPress default gallery in comments which has embed code like this: [gallery link="file" columns="2" size="medium" ids="1,2"] To do so, I added this code which enables shortcodes ...
0
votes
1answer
31 views

update_metadata() appends shortcode data for every page refresh

New to Wordpress. I have an implementation where I am writing multiple shortcodes on the admin panel and for every shortcode, I will update a post metadata key with every shortcode I find on the post....
0
votes
1answer
24 views

filter custom field with checkboxes and show it with one shortcode

I have a custom field with checkboxes. I created a code to show post-typs filtered by checkbox value with shortcodes e.g. [bettenaert-Querbett]. The code works but do not look nice. if ($i = '...
0
votes
2answers
19 views

multible shortcodes (for differnt values) with one function

I am trying to create a function whicht has different shortcodes as output. I have the post-type => womos and the field => personenzahl. The field has the values 1 up to 7. Now I need a shortcode for ...
0
votes
1answer
14 views

Display Custom Post Type Archive content with Shortcode

So I've created a custom post type filled with Advanced Custom Fields only. There is no "content". I've created a single-custom.php, content-custom.php and archive-custom.php. All looking nice and ...
0
votes
1answer
24 views

Print shortcode according to site language

I'm creating my website with "elementor plugin". So I used to customize the default WordPress search result page since I couldn't access it with elementor. Anyway, I tried to display my custom ...
0
votes
1answer
50 views

create a shortcode with acf including a filter

I am using advanced custom fields and my problem is: I have several campers for a different number of persons. Now I need a shortcode to display all campers for all certain numbers of persons. The ...
1
vote
1answer
39 views

How can I included CSS to a page or a shortcode? [on hold]

I would like to add CSS to a page or a shortcode (preferably a shortcode) that would not be dependent on a theme, a plug-in or anything. I tried adding wp_enqueue_style('[my-css-url]'); to various ...
0
votes
2answers
30 views

WP_query only displays one of my custom post type entries

I create a custom post type and wrote a shortcode to display the posts on the front end of my website, but the code only displays one (1) post, and the most recent one. See front-end page here -> ...
0
votes
1answer
26 views

Duplicated content with custom shortcode

Preamble In my functions.php file I added a custom shortcode. This shortcode takes a query as a parameter and queries the wordpress database. From there it takes the posts content and returns it. ...
2
votes
1answer
64 views

Adding span tags within wp_list_pages list items

I am using this shortcode to produce a list of child pages of a specified parent. I would like to replace the list items default discs with a font awesome icon. According to the font awesome ...
0
votes
1answer
22 views

How to retrieve category of a post in have_post loop?

I am using a CPT (post_type => 'portfolio_type', taxonomy => 'portfolio_cat'). Under this CPT, I have design, web development category. I am trying to get the post with the category. My best try, ...
0
votes
0answers
19 views

Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields

I'm trying to fix an issue that requires multiple array queries inside a loop. I'm no PHP whiz, but I got one part to work. I can't get the other part to show correctly. I'm using a collapse repeater ...
2
votes
1answer
28 views

Display a text message if the shortcode is found?

For a few hours I try to show a message only if there is a gallery Picu, without success, an idea? Have try this code, but not work: /** * galeries content */ function ...
0
votes
1answer
24 views

wp_link_pages shortcode for 'nextpagelink'

I want 'nextpagelink' shortcode [nextpage_shortcode] that I can place inside content. I've seen threads where they say that you can't place anything related to the wp_link_pages inside content due to ...
1
vote
2answers
35 views

How to use div class between the shortcode variable?

i called wordpress function between the shorcodes as a input. <?php echo do_shortcode('[shortcode]'.$var.'[/shortcode]');?> how to add div class for the $var here? I tried few combination ...
1
vote
2answers
109 views

How to limit the content coming from wordpress shortcodes?

I am working on a wordpress shortcodes in which I want to the limit the content coming from a xml. The code which I have used for wordpress shortcodes is: function podcast_func( $content = null ){ ...
3
votes
2answers
125 views

Display a text message if the shortcode is not found?

I'm using the do_shortcode function to add a shortcode in a page. But I would like to check if that shortcode exists before displaying it. If the user has no gallery, I would like to display a message ...
1
vote
1answer
12 views

How to get specified parent page title in my function

Below I have a function that prints the child pages of a parent. I am trying to obtain the specified parent pages title as a h2 above the unordered list. I have tried updating the title_li and also ...
1
vote
1answer
13 views

List child pages of specific page using shortcode

I have written the function below to list the current pages child pages. Now what I am trying to do is list the children of a specific page using its slug in the shortcode. Is it possible to sneak an ...
1
vote
1answer
24 views

Using a shortcode to create a dropdown menu from wp_nav_menu list items

I'm using the following function that I found online to render each page's individual nav items to the page: function print_menu_shortcode($atts, $content = null) { extract( ...
1
vote
0answers
30 views

How to save a shortcode in a Gutenberg custom block?

I am creating a Gutenberg block, and in the save function I am returning a shortcode. When I click on save the page, a message is displayed: "Failed to update", but when I check the front end it has ...
0
votes
2answers
15 views

How to use strip_shortcodes() from a spawned process?

I have a plug-in that spawns a process to carry out a print function. The item to print, in this case a Woocommerce product, is passed via the URL (via product_id). Before carrying out printing, all ...
-1
votes
1answer
15 views

IFrame Shortcode plugin - issue

[iframe src="https://www.quora.com/" data-no-lazy="1"] Hey guys I'm trying to add external webpage to wordpress. I'm using "Flyn San" plugin for that but its not working properly. I have attached the ...
0
votes
1answer
42 views

How to dynamically add wordpress shortcodes

I'm working on a plugin where the user can build a form and then display that form on the front end using a shortcode name of their choice. In the database I have a list of form names, and the ...
0
votes
1answer
42 views

Slow page Loads When Using Dynamic Coding

I have written code to get certain tags, and then show the products that have those tags. This is the code: $tag_string = ''; for ($i = 0; $i < 8; $i++) { for ($j = 0; $j < 8; $j++) { ...
0
votes
1answer
18 views

Just display content between shortcode brackets

I am rewriting a theme with shortcodes in the all the posts from the old theme. I searched all the files for the original shortcode function but get no results. So in a vanilla theme the page prints ...
0
votes
1answer
10 views

Turning variable into a value set in shortcode

I have a site on WordPress, and first of all I have this PHP shortcode that helps me to make customizable links in WP post editor without turning my CSS files into a dump of classes with basically the ...
1
vote
1answer
21 views

Show own shortcode data on each page

I have shortcode [cities] and i need that when i import my pages to wordpress with text with this shortcode, there was own city by page id. Is it possible to do? I created a simple shortcode: ...
1
vote
1answer
25 views

shortcode to output multiple images urls from media library id

I am writing some custom shortcode which outputs an images url from its ID. I would like the shortcode usage to be as follows: [imagez id="211046, 211034"] This is my code: function image_thingy($...
1
vote
2answers
46 views

Remove empty p-Tags in Shortcode content before non p-Tags

We build a media (based on bootstrap 4 media object) shortcode with the following syntax: [media img="https://via.placeholder.com/64x64.png"]<h5>List-based media object</h5>Cras sit amet ...
0
votes
1answer
33 views

PHP not outputting the onclick in anchor tag

I have this plugin code function add_neori_social_share_buttons_icons($atts){ global $post; $url = get_permalink($post->ID); $url = esc_url($url); $media = wp_get_attachment_url(...
0
votes
0answers
49 views

Wordpress 5.1 and Syntax highlighter, problem with HTML encoded special characters

I'm using Wordpress 5.1 and Gutenberg block editor. I'm trying to show some Java code with the plugin SyntaxHighlighter Evolved. When editing a post I use the block 'Custom HTML' then add the code [...
0
votes
0answers
24 views

Add attribute to existing Shortcode

I have an existing shortcode (from a plugin) and I would like to add a new attribute or parameter to this shortcode. The shortcode looks like this: [my_shortcode_from_plugin_xyz posts="5" autoplay="...
0
votes
0answers
12 views

Shortcode inside another shortcode / Post page to Woocommerce

Good morning, I made a shortcode [block id="tt2"] in a post, which included another shortcode to insert php in brackets [insert_php] phpcode [/ insert_php] but then, when inserting the first shortcode ...
0
votes
1answer
34 views

SQL query to bulk change short code in all posts

PHP/SQL noob here. Based on this question I attempted to change some entries in phpmyadmin for my wordpress blog: I want to all galleries to link to file instead to file attachment (add link="file" to ...
1
vote
1answer
55 views

WordPress Shortcode show database row

Good day, I was wondering if can do a shortcode that gets all the fields in a row stored in a database, with the difference that I do not want to do many shortcodes for the speed of the site. The ...
0
votes
1answer
28 views

Display shortcode in text field with wordpress settings api

I'm trying to figure out how to display the output of a shortcode in a text field using wordpress settings api. My goal is to create a few shortcodes so that I can use one or the other along with some ...
0
votes
0answers
14 views

Last Page or First Page Pagination

How can I make a first page and last page link? $pagination = paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?...
0
votes
2answers
19 views

display number of posts by category Shortcode

I have this code for show count of posts by category. If I visit category sports, show in header 34 articles. If I visit Nutrition Category show in header 12 articles. But this code is wrong, anyone ...
0
votes
0answers
10 views

Embed Phantomjs alternative inside plugin

I use phantomjs inside plugin in order to render a page with a custom shortcode and capture the generated output as an image. So i use php-Casper (which relies on PhantomJs) in order to capture the ...
0
votes
2answers
40 views

menu item to display the most recent post

I spent most of the day reviewing past questions and answers and have not found anything that addresses what I am trying to do. Maybe I didn't word my search correctly. Lets say I have a category of ...
0
votes
1answer
14 views

Replacing entire tag with shortcode - JavaScript [duplicate]

I'm trying to replace a whole tag with a shortcode, if the tag text equals a value. I'm placing this script into the footer of the page. Here's what I'm trying: var stockcounter = document....
0
votes
2answers
34 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 ...
0
votes
2answers
25 views

Code is providing a row of data but not formatting it as table

I am using the following code: function seconddb() { global $seconddb; $seconddb = new wpdb('username','password','g3boat5_G3_Genba','localhost'); } add_action('init','seconddb'); // add the ...
0
votes
1answer
59 views

Display Data in Table from External Database in WP using Shortcodes

I have successfully coded a secondary database connection for my wordpress site in the functions.php file in wordpress. I have used the following to create shortcode and run the data to my table where ...
0
votes
1answer
36 views

use add_action in a shortcode (gravity form - Wordpress)

I have a shortcode. With this one, i get the ID (number) of a formular $num_formular. Then, with this one, i had to send all the data in the database. When I run the following code, it works: ...