Categories
Mastering Development

Composer autoload: class not found in production, locally works

I read a lot of threads about my problem but I can’t find the correct solution. I wrote my own wordpress plugin and used composer for it. Locally it works fine but when I upload my project onto my webserver I got an error message about class not found. MyOwnHooks not found in /wp-content/plugins/my-own-hooks/myownhooks.php. Directory […]

Categories
CMS Mastering Development Wordpress

Calling a function of a plugin from wordpress theme header file

wp-content/plugins/ultimate-member/includes/core/class-permalinks.php namespace um\core; class Permalinks { function __construct() { add_action( ‘init’, array( &$this, ‘activate_account_via_email_link’ ), 1 ); } } I want to call this function ‘activate_account_via_email_link’ from wordpress/theme/header.php My code so far : $action = new um\core\Permalinks; $action->activate_account_via_email_link(); The error : Fatal error: Uncaught Error: Class ‘um\core\Permalinks’ not found in /home/xyzz/public_html/xyz/wp-content/themes/university/header-frontpage.php:5 Stack trace: #0

Categories
CMS Development Wordpress

Oder status not updating after sucessful payment on woocommerce paymoney payment gateway

it could be error of old function used in this gateway can anyone help me to sort out this ? class WC_Gateway_Payu_In extends WC_Payment_Gateway { /** * __construct function. * * @since 1.0.0 * @access public * @return void */ public function __construct() { global $woocommerce; $this->id = ‘payu_in’; $this->method_title = __( ‘PayUmoney’, ‘woocommerce_payu_in’ ); […]

Categories
CMS Development Wordpress

Is there any way to get post meta from publish_post hook?

I want a post meta of the published post, below is the code but I didn’t get it. Appreciate if anyone can help me here: class BarrioBlog { function __construct() { add_action( ‘publish_post’, array( $this, ‘on_publish_post’ ), 10, 2 ); } function on_publish_post($post_id, $post) { echo ‘ custom field: ‘ . get_field(‘channel’, $post_id); exit; } […]

Categories
CMS Development Wordpress

Custom do_action seems to not be calling?

Quick foundation, there is a plugin that upon the admin uploading a file to the database fires off an action. (If it matters, this do_action is in a static function in the plugin’s files.) I hook into this with an add_action which performs some logic. Within this logic, I fire off my own CUSTOM do_action […]

Categories
CMS Development Wordpress

Override the plugin class and function

hope somebody could help me. I have bought one plugin. But I need to change the function of the plugin in my child template functions.php Here is the classes and functions of the plugin. I need to change the function “get_product_price” with my value. class TOP_Woo { public function __construct() { .. .. $this->init_hook(); } […]

Categories
Development

Extend Parent Class To Modify Default Shortcode Output

I’m trying to modify the default output for a shortcode included in a parent class plugin. This is the code i’m using class My_Child_Shortcode extends Parent_Shortcode { function __construct() { parent::__construct(); remove_shortcode( ‘parent_shortcode’ ); add_shortcode( ‘parent_shortcode’, array( $this, ‘modified_shortcode’ ) ); } function modified_shortcode( $atts ) { $output = ‘Modified Output’; return $output; } } […]

Categories
CMS Development Wordpress

non-unique #_ajax_nonce id in browser console

I have added multiple custom fields through a meta-box, and i have used wp_nonce_field function that generates a nonce for each field and every thing is working for This meta box, but also WP renders those custom fields below the meta box, but without unique nonces, which displays a console error of non unique nonce […]

Categories
CMS Development Wordpress

Plugin – Combine Meta Box Input Fields into single saveble record

Im a complete novice when it comes to coding. I have managed to build a theme with some custom post types. Within the custom post type i have used a generator tool to create a custom meta box. It almost does everything i need except… …………………………… In the code below you will see a field […]

Categories
CMS Development Wordpress

How to add category pagination under single post?

I don’t want to split the post, my purpose to add the category pagination under each post is simply click on 1,2,3,4,5…. pagination and go to the exact page of the same category. Let me explain again, For example, I am reading a post called “ABC” that is posted under the category called “PANDA”, so […]