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
0 answers
18 views

How to trigger shortcode loaded by CSS

My theme has an option to display the tagline in logo area of the header (tagline added using theme Site Identity settings) Using CSS I can supplement the tagline with additional content (words etc). ...
Todd's user avatar
  • 31
0 votes
1 answer
27 views

correct way to enqueue js and css files for wordpress shortcode?

I have created a php class file. I am enqueuing the required CSS and JS files in the class's constructor. public function __construct() { add_action('wp_enqueue_scripts', array($this, '...
SDeveloperj's user avatar
1 vote
1 answer
21 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 ...
John's user avatar
  • 157
1 vote
0 answers
25 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
0 votes
0 answers
25 views

Wordpress display post count for custom post type

I have a custom post type created and a taxonomy with CPT plugin. Using Elementor I created an archive page to show the posts from the taxonomies created. I would like a shortcode to dynamically ...
Cosmin Dan's user avatar
0 votes
1 answer
124 views

get_the_ID() retrieves same ID on Gutenberg's Query Loop

I'm using Gutenberg editor and I want to add a shortcode (using XYZ PHP Code) that uses the post id to retrieve certain ACF value. I'm editing the home page where the last blog posts are shown, but I ...
Alvaro's user avatar
  • 119
0 votes
1 answer
38 views

SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop

I'm creating a template for a custom post type & I'm trying to add a WP Query loop displaying specific Divi projects filtered by tag. I'm inserting the loop using a shortcode, & I've ...
megseoh's user avatar
  • 21
1 vote
1 answer
12 views

Resending woo-commerce order emails from frontend

I am trying to create a simple shortcode [resend_woo_emails]. This shortcode will create a form with a dropdown with all email classes, an input field for cc emails, and another input field for ...
Joy's user avatar
  • 31
0 votes
1 answer
24 views

Strip and print only the numbers found in current's post excerpt (even if they are without space)

I have a working code for printing just the year (number) if found in the current post excerpt, but the problem arises when the number (a year) is followed by a Japanese character (example: '2023年', ...
vyperlook's user avatar
  • 167
0 votes
0 answers
33 views

Can make_clickable work with shortcodes?

I've looked at this... https://wordpress.stackexchange.com/questions/76394/does-wordpress-has-an-automatic-link-parse-function But because I'm using shortcodes in my page it doesn't work. Is there a ...
Pete's user avatar
  • 998
1 vote
1 answer
59 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
0 votes
0 answers
42 views

What hook runs wpautop on template content?

I have a shortcode that outputs HTML and I've inserted it into a single post template. The output gets extraneous <br/> and <p> tags, which I've read in other topics are likely due to ...
Aayla Secura's user avatar
0 votes
1 answer
25 views

How can I strip a single tag from an email post

I'm trying to send emails showing my post contents when I publish something on my site. However, my posts have videos so I'm trying to remove that from the emails that go out. Here is the current code ...
Jeremy's user avatar
  • 1
0 votes
0 answers
23 views

Wordpress Gallery only allowed 10 times per post

I am trying to use the gallery shortcode multiple times within a post, two images per gallery, 15 shortcodes per page. It will only work as expected with modal popup for the first ten iterations, the ...
commbot's user avatar
0 votes
1 answer
35 views

How do I create a shortcode that returns a logged in users' email?

So far I have this: $current_user = wp_get_current_user(); function shortcode_get_email() { $user_id = get_current_user_id(); if ($user_id <> 0) { return $current_user->...
Hercules' Creed's user avatar
0 votes
1 answer
26 views

Shortcode return vs echo. Return messes with data URLs, echo does not

I am trying to create add-to-calendar links using shortcode. However when using return following shortcode function outputs a broken link. (echo does not!). Wordpress documentation recommends using ...
gnat's user avatar
  • 1
0 votes
0 answers
21 views

Display file contents within Plugin

Does anyone know what I am doing wrong - I try to display forms from different files within my plugin. all is triggerd by my_shortcode where the via $atts the user choses which form to display. This ...
gladys's user avatar
  • 11
1 vote
1 answer
120 views

How can I create a shortcode that shows a list of categories on the single product page?

This may seem simple but I want to create a shortcode called [woo_prod_categories] that will simply display a list of the categories of a specific product on the single product page (each linked to ...
Inventive Web Design's user avatar
0 votes
0 answers
19 views

Adding dynamic shortcode to dynamic link on wordpress?

If anyone can help me I would greatly appreciate it. I would like to make this link open a messages page, where the better-messages plugin is installed, the page would open with the users name already ...
Alex's user avatar
  • 1
0 votes
1 answer
32 views

How to exclude some cats from wp_list_categories using shortcut

I would like to display categories of a custom post type but not all of them. I'm using shortcode like this [categories exclude="56","59"] but it doesn't work. Can we exclude some ...
latif tahta's user avatar
0 votes
1 answer
26 views

select categories by ids/display terms only selected

We could display images in gallery using shortcode just like this [gallery ids="130,126"]. I would like to achieve same thing but for categories. I have a shortcode that displays all terms ...
latif tahta's user avatar
0 votes
1 answer
56 views

How to use multiple values in "Shortcode"? [closed]

I've requirement to use multiple values for Shortcode. Currently I'm adding 2 separate shortcodes for the same e.g. [wpcode id="2658"] [wpdiscuz_comments] Is there a way to use single ...
vikramvi's user avatar
  • 101
0 votes
0 answers
10 views

How to prevent WP query searching in executed shortcodes

I am trying to figure out why the shortcodes are executed. My search module looks for a search query in posts via WP_Query. The problem is that in my posts, there is an elementor widget showing a nav ...
Ben's user avatar
  • 1
0 votes
1 answer
25 views

Developing an IP lookup function using an API

I'd like to implement the ability to incorporate an API into my Wordpress blog that allows people to perform an IP lookup within my blog. So far all of my attempts have failed when incorporating the ...
skarz's user avatar
  • 111
0 votes
0 answers
40 views

Shortcode cannot parse attributes within double quotes. " is becoming ” breaking my shortcode

I made a plugin that creates a shortcode to calculate the time since a particular date in the past. It has two attributes, a date string and units: function timesince_shortcode($atts) { $atts = ...
Sidewinder's user avatar
0 votes
1 answer
79 views

conditional shortcodes

I want to use a shortcode ([ex]...[/ex]) within the title of a post in order to style the text in a certain way (<h1>part of <span class="ex">title</span></h1>). ...
monsieurbecker's user avatar
0 votes
1 answer
8 views

strange issue with get_post_type() when using it in a shortcode in text widget

I have a simple shortcode to show post_type slug when I needed. when using shortcode in text widget: -in "post_type single page" it's working -But in same sidebar and same widget in "...
Mohammad J's user avatar
0 votes
0 answers
50 views

How to edit a widget code?

I use a Latest Portfolio widget, but it can show max 20, but I need 30. While using Inspector, I can see the counter from 1-20, but cannot figure out which file has it. I viewed almost all files but ...
Pagula Majorda's user avatar
0 votes
1 answer
107 views

wordpress shortcode url decode non Latin character

I am using a shortcode to call some posts with a permalink using non Latin characters. However the urls get percent encoded ( showing up as %20%regfd etc) What is the best way to make sure urls are ...
Missblues's user avatar
0 votes
0 answers
18 views

Why does my shortcode query not working with search term

I have made code to display posts by search term, but it is not working. /** * Display posts. */ function dispost($atts, $content = null) { global $post; ...
user230593's user avatar
0 votes
1 answer
101 views

How to use shortcode to get the second to newest post?

I've done considerable research, and tried multiple solutions to my task, and currently have found a way but i know it is not the best, so hoping for input to do this better. The task I am using ...
Ben Blue's user avatar
  • 117
0 votes
0 answers
20 views

Custom shortcode with < in content

I have created a custom shortcode for rendering text into tables. Without going into the details of the shortcode, I have initiated it with the following: [CardText type="tablelist" debug=&...
Mike's user avatar
  • 13
0 votes
0 answers
33 views

how should i get products based on tags in woocommerce

i want to write a shortcode to get or filter products by tags. for example, i want to get all products that have both 'male' and 'sport' tags. i don't want to separately find product that have 'male' ...
sina barsa's user avatar
0 votes
1 answer
135 views

WP_query shortcode inside acf Repeater breaks the repeater loop

I have a shortcode that lists CPTs and works great everywhere but if I use the shortcode in an ACF repeater the reapeater stops repeating right after the shortcode. I tried reseting postdata in ...
Joe Barrett's user avatar
0 votes
1 answer
205 views

How can I add a zip code service availability checker in Wordpress without Woocommerce? [closed]

The website is for a business that only provides services in certain zip codes. I would like to be able to display different messages based on if the zip code matches one in my list or not. I couldn't ...
NCBlender's user avatar
0 votes
0 answers
51 views

Working with Shortcode, AJAX, Elementor

it's been days for me to work and did some research about it. I have this page that build in Elementor. Part in the page, is a list of images with custom attribute. For example, <img data-ch="...
Jomar Lipon's user avatar
0 votes
0 answers
26 views

Shortcode Displays 2 times

Created the shortcode but it displays twice whenever I use it. Here is the code: function blog_cta() { $blog_cta = ''; $blog_cta .= '<div class="article-cta-box">'; ...
John Ashley Nohay's user avatar
0 votes
1 answer
72 views

Display a block conditionally based on user input button

I am looking to put 2 donation forms on a page using a shortcode (or block) and I want them displayed based on currency selected by user,So for instance a user comes onto the page he will see 2 ...
netzih's user avatar
  • 101
0 votes
1 answer
49 views

How to execute a shortcode within a custom field?

I am using a plugin that generates a shortcode to display files from a Dropbox folder. I need to display the shortcode on a specific page, but it will be different for each user. Therefore I have ...
Ollie's user avatar
  • 1
1 vote
1 answer
215 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
0 votes
0 answers
9 views

Hiding Widget On Mobile Devices Removes Our Product Search Box On Mobiles

We have a live search product bar on our website, which sits in the right hand sidebar on desktop versions, and we have some custom css which places it at the top on mobile devices, as it would ...
php_555's user avatar
1 vote
1 answer
481 views

Custom plugin with shortcode not working

I have a long-term client with a ton of custom shortcodes and functions for miscellaneous purposes we've accrued over the years and I decided to re-home them into a custom plugin so I didn't have to ...
Vanderbeam's user avatar
0 votes
1 answer
21 views

How call WordPress shortcode inside function file

I am trying to add shortcode to a new WooCommerce tab in the account section that I created in the functions file. add_action( 'woocommerce_account_new-item_endpoint', 'add_new_item_content' ); /** *...
Joey's user avatar
  • 1
0 votes
1 answer
45 views

Buffered output in chunks and shortcode - how do I achieve that?

I wonder how to achieve outputbuffering in chunks when using a shortcode? Without outbuffering: (This works and gets at correct location (under the actual header in template because of return $html;) ...
bestprogrammerintheworld's user avatar
0 votes
0 answers
368 views

Show Login Errors In Wordpress/Elementor (Code "works", but breaks site)

I customized my WordPress/Woocommerce account pages using Elementor and now they don't show error messages when users enter the wrong password, etc. I found this tutorial online that worked nearly ...
Alan_Black's user avatar
0 votes
2 answers
324 views

Using variable as shortcode parameter

The shortcode I'm using is: [survey_records id=number qid="3" aid="selected" data="answer" uid="68" session="last"] I want the id to be variable, ...
user228620's user avatar
0 votes
1 answer
88 views

How to get URL param for pagination in shortcode?

I have made the shortcode which displays data from database. There are so many rows and so I made pagination. But I can't get the URL param which means page number. <?php /** * Plugin Name: ...
Rocky's user avatar
  • 1
0 votes
0 answers
19 views

thumbnail_width not working in wordpress most popular post plugin

I have been using WordPress most popular plugin to get popular post using short code. By default the plugin generated the feature image by 100x75. I want that in 200x200. I use this query to get the ...
Irfan Emon's user avatar
0 votes
1 answer
62 views

Shortcode attributes from meta query variables

In the following shortcode, I have two variable, $today and $tommorrow that are being called inside a custom meta query. function display_prognostika_home_loop($atts, $content = null) { // Get all ...
quantum_leap's user avatar
-4 votes
1 answer
240 views

Undefined Function Fatal Error with Shortcode [closed]

I asked AI ChatGPT: Can you develop a wordpress shortcode to create a list of users of a certain role and for each one show if they commented on a certain post (counting how many comments they left)? ...
Simone Bionda's user avatar

1
2 3 4 5
55