Create my own shortcode with php

I want create my own shortcode In the text i can put the shortcode for example : The people are very nice , [gal~route~100~100] , the people are very nice , [ga2l~route2~150~150] In this...

Parse Wordpress like Shortcode

I want to parse shortcode like Wordpress with attributes: Input: [include file="header.html"] I need output as array, function name "include" and attributes with values as well , any help will...

Kannel: how to define "source-addr-npi" and "source-addr-ton" in sendsms URL?

I have some problem with Kannel application. To one of SMSC I send messages with alpha, numeric and shortcode sender id. Every type of sender id requires different "source-addr-npi" /...

How to add jquery readmore function (expand/collapse) to magento CMS pages

I need a read more button link in my Magento CMS pages. I got some long cms texts. I need a Read More link to collapse them. The Read More link has to be always after the first paragraph or ofter...

How to use wc_customer_bought_product function to check if customer bought product in an array

First of all, I am a beginner and new to php so please forgive my ignorance. I asked my first question on stackoverflow today and somebody was kind enough to provide a great solution, so I am...

array_key_exists() expects parameter 2 to be array

My Wordpress page (yarnhk.com) appears the following lines: Warning: array_key_exists() expects parameter 2 to be array, string given...

Creating pages when activating plugin WordPress

Anyone Please help! I have a plugin which creates post_type pages in the backend. The plugin is creating the desired pages but the problem is whenever i try to see the page list, it shows "No...

WooCommerce customer order detail in BS Modal

In a WordPress website running WooCommerce, the user can login in his (default) personal area and display information like: Orders history Download Addresses Edit info Logout In the orders tab,...

Woocommerce shortcode needed for Forgot Password

can someone help me out with Woocommerce issue. I see that they removed shortcode for forgot password, but I am in need of one, since I am trying to embed the form in pop-up. If anyone who had a...

WP Shortcodes not returning content

I am trying to set up a shortcode inside a template file. I have the following setup: As content in a WP page: [test]shortcode![/test] In functions.php: function test( $atts, $content = null ) { ...

Can't set values for select option in Contact form 7

I am trying to add a option value for select dropdown in CF7. I am using following shortcode to generate HTML like <select name="Construction" class="form-control"> <option...

shortcode for a custom post type

I have these code to create my button short code: add_shortcode( 'modal', 'modal_shortcodes' ); function modal_shortcodes( $atts ) { $attr = shortcode_atts(array( 'btn_name' => 'default...

'Unable to create the directory' error in laravel (on the server)

I'm creating a form whereby the user can upload a picture and send it to the server along with the information in the form. Everything was working fine locally but when I uploaded the code to the...

Function to remove wpautop from a specific div tag

WordPress has a built in filter called wpautop that facilitates adding text in the "visual" mode. This function adds <p> and <br> to the paragraphs to provide the "what you see if what you get"...

Why are my wordpress shortcodes not working when using the plugin boilerplate?

I would like to add my shortcodes from a separate file within my plugin, generated by the WP Plugin Boilerplate. I have the following codes: in class-PLUGIN_NAME.php: public function __construct()...

Avada Wordpress wp_remote_get()

Hello All I am at a loss of what to do on our word press site it is saying wp_remote_get() failed. Some theme features may not work. Please contact your hosting provider and make sure...

Show the tax line when rate is 0% in Woocommerce

I’m updating to the latest version of WooCommerce from a very old version. I have noticed that when using the option “Display tax totals: Itemized”, the Tax name is not displayed anymore in...

WordPress custom shortcode breaks saving process (post.php)

I'm experiencing a strange issue with shortcodes in WordPress. When I save the page while the shortcode is added, it redirects me to wp-admin/post.php and shows me a white page with the results of...

Elementor breaks site with custom shortcode

I created a custom shortcode which includes a special loop which includes all posts from different multisite blogs. This solution is provided by this plugin: https://rudrastyh.com/. The shortcode...

Why Divi shortcodes don't render in wp-json?

I'm trying to use the the_content filter to process the Divi shortcodes, but the shortcodes are still appearing. Specifically et_pb_section, et_pb_column, et_pb_text if that matters. add_action(...

fitvids is adding padding-top to youtube video as inline important

I'm using a youtube embed plugin via wordpress to insert youtube videos. They work fine on some pages, but in of my widget areas the plugin adds an inline element of padding-top: 50% to the div...

Display a WooCommerce coupon input field anywhere with a shortcode

I have a small project on what I need to insert Woocommerce coupon field into any page, but this seems complicated for me. I searched on Google about this, but don't have any resources about this....

If product category is empty display text (php shortcode) Woocommerce

I want to show display a message when a product category has zero products. I want to do this via shortcode please. I've tried searching StackOverflow and search engines for some codes to work...

MPESA C2B Validation and Confirmation Transaction Not Responding

I am trying to record confirmed mpesa transactions. I am running them on the safaricom sandbox. My register url function and simulate_transaction both return success from my local...

Warning: Use of undefined constant _ - assumed '_' (this will throw an Error in a future version of PHP) after updating to PHP 7.2

I have checked the other related posts but unfortunately it didn't help my issue. I am getting Warning: Use of undefined constant _ - assumed '_' (this will throw an Error in a future version of...

Get Woocommerce product tag post count via a shortcode

I need to count the number of times a "product tag" is used across the website. Each product has a number of tags associated with it. I thought about creating a shortcode which I can then...

How to get the total amount spent by a user (customer) in WooCommerce?

With the following shortcode I am trying to get user total spent amount, but it is slowing page load (6 seconds). Is it possible to optimize this code to shorten the loading...

Redirect WooCommerce Category to a Page

My aim is to redirect product category to a page instead of their default category screen I'm currently using Redirection plugin (https://pl.wordpress.org/plugins/redirection/) for redirections....

AWS : Bitnami : UNYSON : Cannot create temporary directory

I am facing the below issue- WordPress 5.7.2 <> Tyring to install the required extension for UNYSON framework...and getting below error - Install Extension Install theme compatible...

WooCommerce: "This key is invalid ..." error

I've created a custom reset password page on my WooCommerce site. The reset page was previously /my-account/lost-password/, but my custom page is /reset-password/. In my theme, I've copied over...