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
1 answer
6 views

I have a php function with a shortcode to add share buttons, but I'm having an error!

I use a php function to create and add share buttons to specific places through a shortcode. It work's fine, but I'm getting this error: Warning: Array to string conversion in ...142-custom-shortcodes....
GKaplan's user avatar
0 votes
1 answer
13 views

Show shortcode output in menu

I would like to show shortcode output in menu like below. How can I do that ?
Foysal's user avatar
  • 449
0 votes
1 answer
10 views

Array to String Conversion warning in shortcode

I have a shortcode that I have been using for awhile that is suddenly causing a warning in WordPress 6.5 the error is "Warning: Array to string conversion in ... on line 109" - line 109 is ...
Dab0416's user avatar
0 votes
0 answers
8 views

Product description is mixed in shortcodes

Product description is mixed in shortcodes I am trying to remove the shortcode in the google feed description. Descpription is not looking very good.If anyone can help , I tried searching on google ...
Karan's user avatar
  • 1
0 votes
1 answer
23 views

Why does my JavaScript work in the browser console but does not work in my shortcode?

I am trying to create a shortcode the user can just insert which creates a button that loops through an array and displays it or hides it. On page load I want every item with an index >= 1 to have ...
rnkwill's user avatar
0 votes
1 answer
25 views

Getting the wrong featured image on archive page

I assigned my posts archive to a site on settings -> reading. I added a post thumbnail to this site, and i want to show the image with a shortcode i have written in my plugin. The problem is, that ...
LovinQuaQua's user avatar
0 votes
0 answers
19 views

How to add button to WYSIWYG to insert shortcode with params (filled in system popup)?

It seems to me that there must be a solution, but I haven't found it. During the theme development process, we create many shortcodes for inserting unusual html layouts into the text. It would be ...
Oleksiy Goldayev's user avatar
0 votes
2 answers
32 views

Shortcode to show author role on the author archive page

I have an archive page to show each author domain.com/author. On the archive page for an author domain.com/author/john-doe I want to display few information like name, e-mail address and role like ...
Guillaume Sorel's user avatar
0 votes
1 answer
20 views

Custom Field in Page Title

I need to show a custom Field in a title (CPT) I have this code function wpse_224340_document_title($title){ global $post; // make sure the post object is available to us if(is_singular('mec-...
Laurapnunez's user avatar
0 votes
1 answer
20 views

Nav Menu Short code Not working When non Login

I have made a toggle button with short-code for dark/light mode code below function dark_light_toggle_button_shortcode() { ob_start(); ?> <!-- new button --> <div id="...
Atiq Rev's user avatar
0 votes
0 answers
34 views

How to make this shortcode not refresh the whole page when i use it on frontend

everyone, I have this code that makes all the files in a folder visible and downloadable on the frontend through a shortcode. But I want to put it in Essential Addons' Advanced Tabs, and they don't ...
Maellion's user avatar
0 votes
0 answers
12 views

Sidebar inside page conten

I have WordPress page's or pages' layout like this: I'm wondering what would be the best way to handle this. I was thinking about adding shortcode inside column, that would export widget area: ...
Filip Witkowski's user avatar
1 vote
2 answers
94 views

wp:shortcode works in block theme template file but not PHP include file

Block markup generally works in included PHP files. I prefer to use PHP includes in many cases as I can do more interesting things with it than I can with a template file (.html). I've just ...
JDQ's user avatar
  • 149
0 votes
1 answer
43 views

shortcode appears as text in the search result

I have a shortcode added to the listing grid and the shortcode is working fine but then it displays it as text on the search result. <?php function booking_popup_snippet() { // Get the wpcode ...
futureyoon's user avatar
-1 votes
1 answer
52 views

Display the progress of post achievement with percentage against target in wordpress dashboard

I have a cpt called "movie", and I set a target for writers to make 50,000 posts in 6 months. The question is... can I make a percentage of the results of the number of recent posts against ...
Tuagapat Manam's user avatar
0 votes
0 answers
20 views

Want to call shortcode after every blog post title automatically

i want to call shortcode after every blog post title automatically. It's a search box which already using on pages when i place the shortcode, now i want to add it on my 500+ posts once, is there any ...
user237589's user avatar
0 votes
1 answer
46 views

How to get next day date of a specific day

I have created a shortcode in WordPress to show next day date of a specific day but it does not show the correct date when I am passing the parameter through the shortcode. Can anyone tell me what I ...
v morgesh's user avatar
0 votes
0 answers
22 views

add a meta value to the shortcode twice

I would like to build a shortcode looks like below. [employee_session trigger=session-popup-1 trigger_type=id in_dialog=1 employee=1] [employee_session trigger=session-popup-2 trigger_type=id ...
futureyoon's user avatar
0 votes
0 answers
25 views

post_content return zero!

I am new to WordPress I made a function as a subscription form. when I want to check it on another function I use global $post; if (has_shortcode($post->post_content, 'up-vip')) {....} I don'...
D.JCode's user avatar
  • 201
0 votes
0 answers
5 views

"Joined in" or "Member since" displayed on single store page and then using shortcode to add

I'm trying to add the registration date of users (vendors) to my single store page. This would ideally read "member since (date)". I also want to use shortcode so I can apply this manually ...
MattyC's user avatar
  • 1
0 votes
0 answers
22 views

Products are displayed only in the admin area

I have a code: $products_query_params = array( 'post_type' => 'product', 'product_cat' => 18, ); return new WP_Query($products_query_params); I need it to get products. But it works ...
Wembley's user avatar
1 vote
1 answer
19 views

Which PlugIns have a [subpages] shortcode? [closed]

I'm repairing a site that was hacked a long time ago. I have many pages that have this in them: [subpages] (and I think that's called a short code). The plugin is gone, so the page just shows the ...
NealWalters's user avatar
0 votes
1 answer
51 views

How do I edit text color for shortcode?

I am trying to learn web development and using WordPress to make a site. I have Event Calendar, and Event Tickets Plugins. The Event Tickets Plugin uses short code to generate a checkout page after ...
Schmeckle's user avatar
0 votes
0 answers
23 views

Plugin Inserts content before Page Content [duplicate]

I have a plugin that pulls comic book data from the Marvel API. I have assigned it a short code. When I place the shortcode on the page it does the following: Before: After inserting the shortcode it ...
user1689274's user avatar
0 votes
0 answers
23 views

add_action to only be called if uploading media from the front end

I have written a shortcode which allows some users to upload to the media folder. This is done using the wp_enqueue_media scripts. I would like to add an action which fires when a user uploads this ...
StripyTiger's user avatar
0 votes
1 answer
101 views

How to create blocks from shortcodes?

I want to create a shortcode of myself that outputs “blocks”. Level 1: Setting a pure text I know how to do a simple shortcode. Let’s take this example. add_shortcode( 'greet', 'myNiceShortCode' ); ...
Xavi Montero's user avatar
0 votes
0 answers
13 views

How to add content region to a post or a page

I need to add a region to a certain pages. Currently our posts are one column. What we need to do is to add region where we could display Table of Contents so it would become two column layout ...
Łukasz Korona's user avatar
0 votes
1 answer
22 views

Update shortcode values using ajax call

I'm having a problem with a calendar, I've made a shortcode which returns events links in a grid that shows the current month view. I set $month_index in order to navigate through months (default is 0 ...
Enrico's user avatar
  • 11
0 votes
1 answer
33 views

php codes ruins shortcode structure

I'm trying to use shortcode in index.php but when I use PHP code in my shortcode, it displays out of shortcode structure. this HTML code works <?php echo do_shortcode('[myshortcode label="...
Dragut's user avatar
  • 173
0 votes
0 answers
53 views

Global variable not showing in shortcode

I am trying to show some variables when I hover over products image. For that I am using a shortcode to show the variable I need and the function do_shortcode(). However the needed variable is not ...
Mehdi's user avatar
  • 103
0 votes
0 answers
35 views

How to add a shortcode for an image in the following function

This is a function by Tobias Keller for PRG Pattern Link Masking where title shortcode is link text. How то add image shortcode alternatively instead text ? $use_prg = new prg_pattern(); class ...
arteaster's user avatar
0 votes
1 answer
60 views

How to make my logged-in user-role shortcode displaying name instead of slug?

I am trying to get my frontend to show the role of a logged-in user via Shortcode. I have the Shortcode functional (see below) but it displays the slug and not the real name in the frontend. This is a ...
user235991's user avatar
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
145 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
55 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 ...
learningtech's user avatar
1 vote
0 answers
31 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
50 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
639 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
  • 131
0 votes
1 answer
107 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
33 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
26 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
  • 177
0 votes
0 answers
41 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
278 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
78 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
27 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
39 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
128 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
35 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
37 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
987 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

1
2 3 4 5
56