Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
12 views

Multiple Shortcode Creation In Functions.php Using Else,ELSEIF [closed]

Please excuse my ignorance! I almost don't know what I'm talking about. Our website currently has php written to create shortcodes that pulls data (forum posts) based on when it was posted for a ...
user avatar
0 votes
1 answer
16 views

Show Featured Image Dimensions and size frontend with shortcode

I was wondering if I can show my featured image Dimensions (W x H in px) and the filesize in mb. In my Wordpress post with a shortcode. thank you in advance :)
user avatar
0 votes
0 answers
17 views

shortcode that have access of information outside [closed]

I'm really new to wordpress dev and I try in fact to make a plugin work the way I want. I use (start using) motopress hotel plugin, and sadly they don't provide a simple way to send specific mail when ...
user avatar
  • 101
0 votes
1 answer
40 views

make user_id in a shortcode dynamic based on who's logged in

I basically have a contact form which generates a PDF output using a third-party plugin. The plugin allows for the use of shortcodes to add content to the final PDF. I want to be able to display the ...
user avatar
0 votes
0 answers
22 views

How to add site tags in alphabetical order to shortcode?

Good morning. There is a shortcode that displays site tags on a separate page. function tag_cloud_shortcode($atts) { extract(shortcode_atts(array( 'cat' => '' ), $atts)...
user avatar
  • 1
0 votes
0 answers
45 views

How to exclude labels from certain categories in a shortcode?

Good afternoon. There is a shortcode [alltags] that displays ALL site tags on a separate page of the site in alphabetical order with a letter. function wph_alltags_shortcode( $atts, $content ) { $...
user avatar
  • 1
0 votes
1 answer
17 views

How can I add a shortcode to query Custom Post Type with ACF in Wordpress?

I am building a website for a client, and I needed to build a game release calendar using Custom Post Type and Advanced Custom Fields. Everything is built out, but the last step. I need to be able to ...
user avatar
  • 119
0 votes
1 answer
30 views

How To Use do_shortcode with WooCommerce One Page Checkout

I'm trying to use the WordPress do_shortcode function for the WooCommerce One Page Checkout Plugin which uses shortcode like this: [woocommerce_one_page_checkout template="product-table" ...
user avatar
  • 35
0 votes
0 answers
36 views

How can i strip shortcode from HTML title tag?

On a website, I am using Wordpress shortcodes for French example words: [ex]beau[/ex] becomes <span class="ex" xml:lang="fr" lang="fr">beau</span>. I would ...
user avatar
0 votes
0 answers
16 views

Can't render shortcode when html tag contains hyphen

Let's say I have a web component called <x-interaction>. I want to pass the ID of the post to the web component as an attribute, so I write a shortcode to render the ID. add_shortcode('...
user avatar
  • 101
1 vote
1 answer
33 views

Where to call add_shortcode function in WordPress Plugin Boilerplate?

I am creating a new plugin and have decided to use WordPress Plugin Boilerplate. However, I'm not sure where the correct place is to call WP's add_shortcode. I'm stuck on two counts: add_shortcode ...
user avatar
0 votes
0 answers
15 views

Get Posts List of Current Selected Custom Taxonomy in Shortcode

I have a custom taxonomy called Album Link (album_link). I created this so I could link all music that has the term e.g (Glorious Album) to an album post type that uses the same term. The goal here is ...
user avatar
0 votes
0 answers
18 views

How to work Woocommerce pagination inside shortcode?

I have a shortcode that shows the orders history placed by user. It works, however I have pagination with WP_Query which is not working. When I click on any page number the same page is reloaded, the ...
user avatar
  • 101
0 votes
1 answer
29 views

How to get woocommerce orders with get_posts method in a shortcode

I'm writing shortcode which must show all orders placed by current user. I followed this two guidee to get them: https://www.businessbloomer.com/woocommerce-easily-get-product-info-title-sku-desc-...
user avatar
  • 101
0 votes
0 answers
29 views

Paragraph Tags removed when contents are only a shortcode

I'm developing a plugin that given a shortcode with attributes will scan a json file and return the appropriate data etc. Given code like this: <!-- wp:paragraph --> <p>[environ data="...
user avatar
0 votes
1 answer
29 views

the_title() & the_content() are retrieving Post details inside a Page, after calling a shortcode

I'm trying to create a custom theme, since I need to convert html pages to be used at WordPress. In about.php page, I have this shortcode to retrieve posts of a category: <?php echo do_shortcode('[...
user avatar
0 votes
0 answers
15 views

Updating Metadata with Shortcode

I'm trying to create the below function to check a user's for the metadata field "order_review_cards", and swap the value for Yes-no or no-yes. Not sure why the code isn't working. I can do: ...
user avatar
0 votes
0 answers
9 views

post_orderby filter breaks function

I have a custom shortcode function to display a list of articles. The list needs independent styling based on the post tag. That part all works. I need it to be sorted by term_order. I created a ...
user avatar
  • 1
0 votes
0 answers
16 views

Counting number of posts in multiple (sub)categories using shortcode

I'm making a new cycling team website and on the home page i have 3 different type of stats: "Win, Podium and top-10" Now i want the number of the stat go up if i post something with for ...
user avatar
0 votes
0 answers
26 views

Need help making a short code work

I will try to explain my question as good as possible. but since english is not my main language I hope you will understand. Im trying to fill a carrousel with a custom post type. if got everything ...
user avatar
  • 1
0 votes
0 answers
23 views

Woocommerce Shortcode which displays a table with product data

I searched for the internet but didnt find anything which works to my use case. I want to have a shortcode which displays a table of products. In each row I want the product to have the following data:...
user avatar
  • 101
0 votes
0 answers
19 views

Set document title through shortcode plugin

I have a plugin a web hosting company made for us, and I need the "current challenge" page to show the challenges name as the document page title. Currently it just displays the page name &...
user avatar
0 votes
1 answer
33 views

What is @Action in Wordpress?

I have found this code snippet on a plugin. /** * @Action(name="workforce_content_loop_before", priority=10) */ public static function show_breadcrumb() { echo do_shortcode( '[...
user avatar
1 vote
1 answer
29 views

How to link to current post in WordPress?

I'd need to get a permalink for this post (current post) in WordPress. Easy to do in PHP but I'd need to use it in the article itself so no PHP? I'd need a button that links to the current article. ...
user avatar
  • 11
0 votes
0 answers
13 views

Adding shortcode of "Random Content" Plugin in the post after the title

I want to add shortcode content into each post after the heading of the post. Below is the code that I put at the end of the function.php but this add the shortcode content at the end of the post, ...
user avatar
1 vote
0 answers
53 views

Taxonomy Order by Name

I created this shortcode to display my custom taxonomy terms: add_shortcode( 'taxonomy_lists', 'wptls_taxonomy_lists' ); function wptls_taxonomy_lists( $atts ) { $atts = shortcode_atts( array( ...
user avatar
2 votes
1 answer
71 views

gutenberg widget outputting paragraph marks

I have created a shortcode to output a wp_Query. Nowhere in my query do I output any <p></p> paragraph marks. However the widget puts this before my output and after. At first I thought ...
user avatar
  • 340
0 votes
0 answers
8 views

How to use a shortcode or an application to dynamically embed content from one WordPress site to another?

Looking to update the content only in one place and have updated to the other site(s). Thinking it can be done with shortcodes but not sure how to create it. I am using Elementor on both sites. Thank ...
user avatar
0 votes
2 answers
40 views

Shortcode won't take into account custom post ID put in parameter

I wrote a little custom shortcode and when I try to use it in a custom post it won't take into account the parameter I set up. What it's supposed to do The shortcode is supposed to take a custom post ...
user avatar
0 votes
1 answer
31 views

cURL External API request displays content above other content on page

I've built a plugin to display our customer feedback on our WordPress website. We use an external feedback system called 'Customer Thermometer'. They have a simple API to use a URL to request stats ...
user avatar
0 votes
0 answers
29 views

using shortcodes inside gravity forms

I'm struggling to use a custom short code (added by some plugin named short code plus) inside a hidden input in gravityforms the short code is [user_firstname] which as it's obvious it shows the users ...
user avatar
0 votes
1 answer
31 views

Help to display the current categories and tags of a post

I am using a shortcode to try to display the tags and categories of a post. Specifically, this is a portfolio post, so when a user visits a post they will see the associated categories and tags. ...
user avatar
0 votes
0 answers
73 views

How to call a function from a shortcode function in an oop plugin

I’m developing an OOP plugin based on WordPress-Plugin-Boilerplate by Devin Vinson. In the includes folder, I’ve created a class for shortcodes: class My_Plugin_Shortcodes { public static ...
user avatar
  • 111
1 vote
1 answer
19 views

Where to filter Shortcode string prior to execution

Whatever WP function assembles the $att array from the [myShortcode att1="..." att2="..." ...] string uses the " character to delimit the data. However, the “ and the ” ...
user avatar
  • 111
0 votes
0 answers
11 views

Beginner question: Accessing js script in plugin

I am completely new to wordpress though i am not new to coding, so i was trying to be able to code more through plugins. What i am basically trying to do is to create my own calculator through a ...
user avatar
0 votes
1 answer
63 views

porto theme pagination on woocommerce not working

here i use code shortcode of woo commerce and whenever i reload page pagination showed up then hide i used this code [products limit="12" columns="5" paginate="true" ...
user avatar
0 votes
0 answers
31 views

Using One Function To Create Two Different Shortcodes

To populate a player rollcall, an extensive query pulls data from tables in my external MySQL database. Part of this also extracts the player(s) who a) made the most appearances and b) scored the most ...
user avatar
0 votes
0 answers
26 views

Wordpress load same script two times

I write a basic plugin with custom css/js. I use wp_enqueue_script for my custom script and use hook 'init' to register script in front-end page. But wordpress load this javascript file two times with ...
user avatar
-1 votes
1 answer
27 views

Why My slider shortcode display above header

//slider shortcode function slider_shortcode($atts) { extract( shortcode_atts( array( 'id' => ''), $atts)); $id = $id; ob_start();?> <div class="...
user avatar
0 votes
1 answer
27 views

calling a custom field value inside functions.php

I am creating a function, for a shortcode that I will use directly in the post content (using [my_description_number] shortcode), and it works, but I do not manage to call (echo or print) a custom ...
user avatar
  • 165
0 votes
2 answers
33 views

Use html inside shortcode function

I know I'm bad with coding, but I tried whatever I could find on the internet, and I ended up with this, which is not giving an error, but also when using the shortcode [my_playlist] in a post, only a ...
user avatar
  • 165
1 vote
2 answers
21 views

Adding to the_content or a variable from within a shortcode function

I've created a custom shortcode to add pop-up definitions to selected vocabulary terms. The shortcode looks like this: [glossary term="data breach"]data breaches[/glossary] The function ...
user avatar
0 votes
1 answer
32 views

How to have shortcode autofilling the content if the attribution is specified?

I want to have a shortcode that can fill the content depending on the value of its argument. Here is my code: function test( $attr, $content ){ $args = shortcode_atts( array( 'content' ...
user avatar
  • 308
0 votes
1 answer
37 views

If do_shortcode is blank, return some message

I have a page for employment postings. To expire the posts, I'm using the PostExpirator plugin with the shortcode, [postexpirator]. If not expiration date is selected within the plugin, I'd like to ...
user avatar
0 votes
0 answers
53 views

wordpress script_loader_tag in function.php

I am trying to add defer and async to my script tags to increase it is performance here is the code that I am using function add_defer_attribute($tag, $handle) { print('hi'); echo('hi'); //...
user avatar
1 vote
0 answers
38 views

How to add AJAX in a custom PHP function using Google sheets API

I have followed a website link to fetch data from a SINGLE CELL of a Google sheet to a shortcode. And I am using that shortcode into the COUNTER widget in Elementor to achieve counting animation while ...
user avatar
0 votes
0 answers
80 views

Is it possible to create a shortcode to link to a specific post/page where the tag is just an attribute?

I'm trying to think of the best way to phrase this. I want to create a single shortcode to link to any post, page, or custom post type but I don't want to have to use the post ID. Ideally I'd like to ...
user avatar
0 votes
0 answers
37 views

Managing and deleting transients with dynamically generated transient names

Let's say I have access to a remote API that stores car data, and I want to be able to place car information box(es) into posts using a shortcode. The shortcode fetches JSON data with wp_remote_get() ...
user avatar
  • 101
0 votes
1 answer
25 views

How to Create custom block for displaying information in content section which act like shortcode

I wanted to Display one block which act like shortcode in front and plugin in background. For Example <div class="one-fourth fl glousp-box"> <p class="figure">5000+</...
user avatar
0 votes
0 answers
7 views

Show content if user left comment / non-logged visitors?

im trying to hide content/show content based on comments. i tried this to achieve what i want. but i want to hide/show content from non-logged visitors also.. this is my final code: // the user may ...
user avatar

1
2 3 4 5
54