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

TablePress extension is messing with my tablet layout

I am using this #Tablepress shortcode [table id=1 automatic_url_conversion=true automatic_url_conversion_new_window=true responsive=collapse /] to have a TablePress table collapse. It works ...
user avatar
1 vote
2 answers
91 views

Wordpress simple 'Hello World' plugin - problems

I am an old-school embedded C programmer but a WP noob, so please bear with me. Here is what I have done so far:- Added a Shortcode in a Theme My function prints out 'Hello World' and is registered ...
user avatar
  • 11
0 votes
0 answers
12 views

Font size of HTML content

I am developing a plugin. In this plugin I am outputting some HTML using short-code. User can choose font size of HTML content from Admin Panel. This plugin is saving font size as meta value in ...
user avatar
  • 387
0 votes
0 answers
16 views

Woocommerce shortcode to display number of items in stock?

Is there an out of the box Woocommerce shortcode that displays the amount of a single product that is in stock? Something like: 10 tickets available I'm using the following shortcode on a regular WP ...
user avatar
0 votes
0 answers
11 views

Only some shortcodes aren't working on custom theme

We had the calls setup exact like they should be, but its not showing correctly. We use this function at the bottom of page add_shortcode('test','testing_function') ?> then in the functions.php ...
user avatar
  • 1
0 votes
0 answers
7 views

Shortcode to show the terms from the current post (custom post type & custom taxonomy)

I want to show the terms that have been selected on the current post. Term names with links to the term page. I need it as a shortcode. I've found many solutions for the default posts/taxonomies, but ...
user avatar
  • 101
0 votes
0 answers
17 views

Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)

I'm making a certificate that's supposed to autogenerate and involves the need for multiple dynamic fields. I have everything else finished but I have difficulty trying to create 3 dynamic fields. ...
user avatar
0 votes
0 answers
13 views

ACF repeater + group shortcode

I've wrote a few line in order to show a restaurant menu in a page using a shortcode add_shortcode ('pescato_repeater', 'pescato_repeater_fn'); function pescato_repeater_fn() { if( have_rows('...
user avatar
  • 1
0 votes
0 answers
22 views

Custom shortcode skips every 2nd shortcode

I'm have the oddest problem. I have a shortcode that querys the DB and returns the result based on the attribute text. The shortcode worked perfectly when I tested using just 1 version. I then used ...
user avatar
0 votes
0 answers
30 views

Help understanding dynamic endpoints based on where a shortcode is used

I am new to PHP and Wordpress development. I have a lot of coding experience with javascript and python so I have somewhat of an understanding of some things since PHP is similar in a lot of ways. ...
user avatar
0 votes
1 answer
86 views

How to echo the value of an array element using a function via a shortcode

I want to centralise the prices on our website, so that I can simply update one place, and once updated it propagates to all pages. I don't want to use a plugin. The idea I have is to create an array ...
user avatar
  • 103
-1 votes
2 answers
46 views

How to Pass ID through Short Code

How to Pass ID and fetch post meta data through Short Code like [my-shortcode id="12"] ? My code is like below. add_shortcode( 'my-shortcode', 'shortcode_function' ); function ...
user avatar
  • 387
0 votes
1 answer
42 views

How to create ShortCode

I am learning Plugin Development. How to create ShortCode like the image ?
user avatar
  • 387
0 votes
0 answers
10 views

Create shortcode for each form field in contact form 7

In Short: I want to access form submission shortcode to make it displayed on a different page with custom text. Hi, I am trying to create a rental property directory listing website. I have used ...
user avatar
0 votes
1 answer
42 views

How can I hide the ACF shortcode when empty

I am facing a issue. I am using a snippet from github. It renders the URL with some attributes. However, when empty, the short code is still displaying and is not being hidden. Here it is: /***********...
user avatar
  • 13
0 votes
0 answers
40 views

MySQL Query Returns Array () In Shortcode

This is in my theme's functions.php. I have an external MySQL database that I'm connecting to in WordPress with the following code, and I'm attempting to create a shortcode that shows the total of a ...
user avatar
0 votes
0 answers
28 views

Cannot output plugin twice with shortcode

With my first plugin, I had some issues that got solved with the help of users here. Now I am facing another issue: I want to be able to output the plugin content (drop-down select form) twice on the ...
user avatar
  • 113
0 votes
1 answer
29 views

Adding custom form within add_shortcode

I'm adding a custom form within a shortcode, but whenever I paste the shortcode in the page editor the form posts automatically and redirects to /wp-admin/admin-post.php with a blank screen. I'm using ...
user avatar
0 votes
0 answers
12 views

Build Clickable Link Using Multiple Attributes

I am trying to build a function for WordPress (running Elementor, if that matters) that will concatenate 3 items to build a URL, then display that URL in a link that will open in a new window. The ...
user avatar
  • 1
0 votes
2 answers
19 views

Set redirect for need login

Hello, I have this code so when I place the [need_login] shortcode on a page, it redirects users who are not logged in to a Login page. The problem with this is the that it redirects them to the ...
user avatar
0 votes
2 answers
54 views

When are Shortcode Attributes Available in Template

I have a template that adds a shortcode. The add_shortcode is at the top of the template, before any template output. Note that any attributes for the shortcode are optional. I don't care if they ...
user avatar
0 votes
0 answers
17 views

how to get sentence values from wordpress shortcode parameter?

I've set up a shortcode that gets sentence value from parameter, but it only returns the first word of the sentence. I've assumed that the shortcode recognizes values after whitespaces, but when I use ...
user avatar
0 votes
0 answers
16 views

Getting Shortcode Attributes befor content is displayed by the template

This regards getting the shortcode attributes to be used in a function called after the shortcode is defined, in a template. The page that uses that template has the shortcode plus attributes, as in [...
user avatar
0 votes
0 answers
40 views

Why wp_remote_get() fetches certain web pages while it doesn't work for my localhost?

Why I'm not able to parse csv files (or equivalently open them) using WordPress shortcode? Problem: I wish to use a shortcode to Parse Contents of a csv file and display its contents effectively. But ...
user avatar
1 vote
0 answers
44 views

Wordpress Shortcode to get URL Parameters $_GET['name'] redirects for no reason at all

Need some help in understanding how does WordPress Redirects work. While working with shortcode: add_shortcode('name', 'get_name'); function get_name() { return $_GET['name']; } The page which ...
user avatar
0 votes
1 answer
27 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
1 answer
50 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
28 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
49 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
46 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
50 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
42 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
27 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
  • 123
1 vote
1 answer
96 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
26 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
41 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
145 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
33 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
37 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
17 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
20 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
29 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
33 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
34 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
30 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
22 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
85 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

1
2 3 4 5
55