2 votes
Accepted

php codes ruins shortcode structure

You need to change the_title() to get_the_title(). You are asking the shortcode to echo out a string that is returning the title. It would be good for you to research the difference between the_title ...
rudtek's user avatar
  • 6,071
2 votes
Accepted

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

No, you did nothing wrong. It's a known issue and in WordPress v6.1.3 and up to the current stable release as of writing (v6.2.2), it's happening because of the following lines in ...
Sally CJ's user avatar
  • 38.9k
1 vote

Shortcode to show author role on the author archive page

You can use the main WP_Roles object to get an array of role names/labels, e.g. $role = 'author'; $label = ''; // if there is no label this will be used instead if ( wp_roles()->has_role( $role ) ) ...
Tom J Nowell's user avatar
  • 58.9k
1 vote

Custom Field in Page Title

Use the wp_title filter, which passes the current title, separator, and location as arguments. It then appends the custom field value to the title if the conditions are meet. For more details :- Visit ...
vijay pancholi's user avatar
1 vote
Accepted

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

Scenario: Gutenberg Blocks -> page.html has wp: include that includes a pattern file that has shortcode in it, the shortcode is not executed and comes back text only. After reviewing and testing ...
WordPress Buddha's user avatar
1 vote

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

Here are my thoughts, which include both a shortcode and a direct function to display the post progress in the WordPress dashboard/admin area: Creating a Custom Shortcode: You can create a custom ...
Will Ashworth's user avatar
1 vote
Accepted

Which PlugIns have a [subpages] shortcode?

I found "Subpage Lister" and it solved the problem. If there are others that use the exact same [subpages] code, then I would like to know. https://wordpress.com/plugins/subpage-view Now, I ...
NealWalters's user avatar
1 vote
Accepted

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

SOLUTION: I looked through Divi's functions.php & saw that the term for the project tags is 'project_tag', so when I amended my $query args it now works! Thank you very much to everyone who ...
megseoh's user avatar
  • 21
1 vote

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

If you have a strict list of allowed years: $allowed_years = array('2018', '2019', '2020', '2021', '2022', '2023', '2024'); Then why are you using regex when you can search for those years directly: ...
Tom J Nowell's user avatar
  • 58.9k
1 vote
Accepted

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

You can try this: function woo_prod_categories() { if ( is_product() ) { global $post; $product_cats = get_the_terms( $post->ID, 'product_cat' ); if ( ! empty( $...
ray-happyforms's user avatar
1 vote

How to use multiple values in "Shortcode"?

You can combine these two shortcodes into one by using a custom shortcode that includes both of them: function custom_shortcode() { $output = ''; // Get the wpcode shortcode output $...
Aprilia Parrino's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible