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

Checking if looped item has a parent inside a shortcode

all I want is to check if the custom post item in the loop has a parent. I am using this inside a shortcode. I could not find how to access the property from inside the loop. Thank you my dears $q = ...
0
votes
1answer
10 views

Restricting shortcode for users

anyway to block any user /role(except the admin) to use shortcode? i want to keep some specific shortcode secret. if somehow users come to know, they cant use it. if only admin writes the shortcode it ...
0
votes
0answers
4 views

snippet code to show logged in users their last purchased woocommerce product,

Please i need a code snippet to show woocommerce users their last purchased product, let it show the product name, Date of purchased and time, please i want it to be a shortcode which i can add to any ...
0
votes
1answer
11 views

Adding author option to [products] woocommerce shortcode

I am trying to modify the [products] shortcode usage: https://docs.woocommerce.com/document/woocommerce-shortcodes/#section-11 What I am looking was passing the author id from short code e.g [products ...
0
votes
0answers
9 views

Use WordPress Shortcodes in TinyMCE5

I am using Wordpress on my site. I wanted a visual editor on frontend of my site. Gutenburg isnt allowed to be put on frontend, and visual editor looks old, so directly using TinyMCE was the best ...
0
votes
1answer
17 views

When echoing my own shortcode, it keeps adding a 1 at the end of my blogpost

I am currently building my own plugin and testing things around, to make sure everything works. I used register_settings() to create a form on my backend, I filled it with information and have no ...
0
votes
0answers
6 views

Remove Add To Cart button on Free products AND add Custom Shortcode [closed]

OK, I want to do two things. 1.) on free products remove the add to cart button. I think the following code from this post will work to do that? function remove_add_to_cart_option( $purchasable, $...
0
votes
0answers
9 views

Why is this shortcode moving?

Really strange bug. I have a shortcode in this page that imports this generated file into a table. In the last few years, when I edited the page, the shortcode for inserting the text would jump above ...
0
votes
0answers
14 views

Displaying an interactive web map on my wordpress site

I created an interactive web map using Javascript, and want to display it on my Wordpress site. I am currently displaying it on a browser webpage. Things to note, the map uses data from a .csv file ...
0
votes
1answer
26 views

shortcode with conditional results if logged in

I need some help, I am learning php through wordpress, so I don't really know the php basic and don't really know wordpress either. so I have this shortcode function: function links( $atts, $content = ...
0
votes
1answer
22 views

How to create shortcodes that pull custom field data from general settings

I am trying to create a custom field in 'settings > general' that I can then create a shortcode for to display on the front-end. I cannot find any particular code that will help specifically for ...
0
votes
0answers
9 views

How can I get the time remaining for an event to appear in few months time

I am looking forward to embedding countdown dates in my wordpress post editor via wp shortcodes. I am not so good in coding, so i have come across already written codes but they require me to input ...
0
votes
1answer
31 views

Custom post type shortcode

I create a custom post type shortcode as slider. My sliders images are displayed in background image as a featured image. But featured image is not displaying in my slides. Here is my code: <?php ...
0
votes
0answers
13 views

couldnt show short code atts in category

i add this shortcode in function : function sub_about_movie( $atts , $content = null ) { $b = shortcode_atts( array( 'name' => '', 'time' => '۹۲ دقیقه', 'language' =>...
0
votes
1answer
15 views

Featured Story Shortcode not outputting content

So I'm trying to get a shortcode working where it calls the posts in the featured story category but I'm having issue getting it to output even just the title from the post. There's no error on the ...
0
votes
0answers
14 views

How to change Woocommerce product shortcode template

I have <?php echo do_shortcode('[product id="163"] ') ?>that returns a product by ID. How can I change the template?
0
votes
0answers
12 views

Wordpress site speed issue while pagespeed score and yslow score is great

I am wordpress freelancer on Fiverr and currently I am working a motorcycle helmet blog. I did my best to create a fast loading and full responsive site in WordPress but I am facing few issues which I ...
0
votes
0answers
7 views

How to get children items of specified taxonomy term inside a shortcode

The following shortcode list children items of a custom term type, how can I add the functionality to list the children of a specified term instead of listing the children on all terms. e,g [...
0
votes
0answers
16 views

Limit number of tags and display random in post content

I'm using this shortcode in post content to display tags I'd like to limit the number of tags that are displayed. I'd like to be able to also control whether random, asc, desc, and ideally most ...
0
votes
0answers
26 views

background featured image display using shortcode

I created a slider shortcode in my custom theme. My sliders images display at the background image. I don't know how can I display background slider images using shortcode Here is my code: $string .='...
-1
votes
1answer
28 views

Any way to hook into WP after a page displays?

Ok, I've tried to find a solution to this problem but so far, no luck. I've been trying to find a way to do incremental output using a shortcode. I've got several functions that take up to 30 seconds ...
1
vote
1answer
9 views

Nested Code Snippets [closed]

I'm new to wordpress and I'm trying to accomplish the following goal: I have a custom type albums seeded by a plugin and I would like to display this data in a list. I installed the Code Snippets ...
0
votes
1answer
23 views

Wordpress shortcode returns the data before <!DOCTYPE html>

I try to make a form with shortcode. Main plugin file: require "functions.php"; function form_shortcode(){ ob_start(); include "form.php"; return ...
0
votes
0answers
20 views

Shortcode in Gutenberg block or do_shortcode

I am wondering which differences there are between to put a shortcode in a Gutenberg block and using the do_shortcode function. In particular, I wonder why the function has_shortcode($post->...
0
votes
1answer
13 views

How to embeded shortcode for another website

I have few website and want to embedded shortcode to another website. Means, 1st website has contact form with shortcode example [form id="123"] Now I want to insert this shortcode in all ...
0
votes
0answers
17 views

Disable wpautop on Shortcode attributes

I have a shortcode which accepts basic HTML tags as shortcode attribute. When this shortcode is used in the shortcode block i.e within <!-- wp:shortcode --> then unbalanced <p> tags are ...
0
votes
1answer
20 views

page shows short code not output

Written the following code in a custom file inside the theme folder and called it via functions.php but at page [product_first_img] shows shortcode text, not output. function gal_first_shortcode($atts,...
0
votes
0answers
23 views

shortcode to display specific recent posts

I'm trying to create a shortcode to display the top 6 recent posts. The shortcode has to be able to capture a true/false attribute of today though I don't necessarily need this to be able to activate ...
0
votes
0answers
12 views

Date Shortcode in Image alt and title tags

I am using the following shortcode for year in my Content. function year_shortcode() { $year = date('Y'); return $year; } add_shortcode('year', 'year_shortcode'); The same shortcode I used in the ...
0
votes
1answer
21 views

access shortcode atts in template part

How can I access the $atts in a BuddyPress template? function test_shortcode_callback( $atts, $content='' ) { ob_start(); shortcode_atts( array( 'foo' => 'this is foo',...
0
votes
0answers
11 views

Price shows up double at Product Page

I'm currently working on a shop for myself. I have a question about a single product list. In the image shown the price shows up double. The first one is the regular one from WooCommerce. I looked up ...
0
votes
1answer
32 views

Show form per shortcode

This is my code. I want to show it per shortcode. $user_id = get_current_user_id(); $balance = mycred_get_users_balance( $user_id ); echo "Current Balance: ".$balance."<br><br&...
0
votes
0answers
5 views

function that gathers all gallery shortcodes

So basically I have a gallery plugin that creates galleries with a specific shortcode. So every time I create I gallery, I first need to create the gallery, and then create a post for it, and the ...
1
vote
1answer
47 views

How do I display “Hello username” if logged-in on the homepage

I am trying to show the name of the currently logged-in user in a small text like 'Hello, username!'. I tried to do this, but it doesn't work: <p class="vam"> <?php if(...
0
votes
1answer
48 views

IF condition based on wp_remote_get output

I'm working on a plugin for displaying content based on the Letter Show in API. Where I want to display the content based on A or B returned by the API. I have created an API here: https://...
0
votes
1answer
15 views

Creating a shortcode by pulling in a custom field from a plugin

I have this shortcode code: add_shortcode( 'dashtest', function () { $stringtest = "This is $wpc_cf_scorp"; echo $stringtest; } ); It is attempting to pull in a custom field created by ...
0
votes
0answers
16 views

Should i Include a .webm file with .mp4 when using wp_video_shortcode()?

I'm using wp_video_shortcode for a .mp4 video within the loop but was wondering if i should also include a .webm videofile as well? If so, how do i include it using the wp_video_shortcode function. I ...
1
vote
1answer
26 views

Localization inside shortcode not working

I use a shortcode that retrieves the url of woocommerce products and builds a link: function woo_url_shortcode( $atts ) { $atts = shortcode_atts( array( 'id' => null, ), $atts, '...
0
votes
2answers
19 views

Can I pass parameters to the add_shortcode() function?

As the title states, I need to pass at least one parameter, maybe more, to the add_shortcode() function. In other words, those parameters I am passing will be used in the callback function of ...
0
votes
1answer
23 views

post_type internal ID?

This may sound like a stupid question, but is there something like an ID associated with the post types (built in or custom) in WordPress? I'm not interested in the actual post id, but wondering if ...
0
votes
1answer
20 views

Probleme shortcode with list author

I have created a list of my contributors for my website it works well. I'm trying to do this with a shortcode in my functions.php. The list appears well. But when I want to place it in my theme in any ...
0
votes
1answer
28 views

Parse Error: unexpected '}' while creating Shortcode with Loop [closed]

I think either I am quite stupid today or just work-blind by this project but I've been trying to fix a little error a new shortcode is causing. This is the code <?php function reviewslide_function(...
0
votes
1answer
16 views

How to test If a post has a particular term

I want to display a different description for a post if it belongs to a specific product category in a filter. I've used the code below code to add the code but it is displaying for all products: ...
0
votes
1answer
20 views

How can I prevent a shortcode div from extending beyond its boundaries?

I have a shortcode for user-defined social media buttons that works well, except for the fact that the div extends beyond its boundaries, meaning that if this shortcode is called in a widget, the ...
0
votes
1answer
19 views

shortcode not return any thing in Gutnburg

I need to create a shortcode in a plugin, when a person gets to install my plugin can he use shortcode inside the plugin : that's my code plugin is working 100% but when I call to shortcode [splite] ...
0
votes
0answers
15 views

By adding “?login - failed” code unable to access my dashboard

I am using the following snippet code to stop customer redirect after wrong password or empty username and password in my WordPress theme. But by adding this code i am unable to access my admin ...
0
votes
1answer
26 views

Why does my custom plugin only function correctly once per page?

I have a custom plugin that uses shortcodes to generate tables which are meant to be manipulated by the user. As they change the number of servings in A2, it will divide the values in B2-E2 by the ...
0
votes
0answers
8 views

Showing custom content from specific function in a page

I have a custom php function that returns some text that I would like to show in a specific wordpress page The fastest idea that comes to my mind, is to return that content through a shortcode and put ...
0
votes
0answers
25 views

Hide content for specific users with id

I want to write a short code so that users who write their id's in it can not see the content of the short code! Example: [hidefrom ids="1,46"]content[/hidefrom] Please help me, I do not ...
0
votes
1answer
29 views

How to edit blog page in wordpress? there is no place to put shortcode

I have a shortcode I want to put on the sidebar which appear only on the blog page and the single post page. so I created a field for this shortcode using Advanced custom fields plugin. when I went ...

1
2 3 4 5
51