Publish Post After Click On A Link

When the post is created and set to pending, build a unique identifier for auto-publishing, for example: $unique = md5( $post->post_content ); add_post_meta( $post->ID, ‘_auto_publish’, $unique ); Now create a link for the email: $link = get_permalink( $post->ID ); $link = add_query_arg( array( ‘autopublish’ => $unique, ‘pid’ => $post->ID ), $link ); Send this link … Read more

change plugin shortcode function [closed]

you can override the shortcode like this : add_action(“init”, function () { remove_shortcode(“timelinr”); add_shortcode(“timelinr”, function ($atts, $content) { // call the shortcode of jqueryTimelinrLoad $result = $GLOBALS[“jqueryTimelinrLoad”]->shortcode($atts, $content); // dequeue style wp_dequeue_style(“timelinr-style”); // enqueue your style wp_enqueue_style(“timelinr-style2”, “new.css”); // result of the shortcode return $result; }); });

Thumbnail with different sizes

Intermediate image sizes are discrete, not variable. When you define an image size, with specific dimensions (whether hard-cropped or box-resized), WordPress will create a discrete image, with the specified dimensions. Otherwise, if width could be defined dynamically, WordPress would have to create a prohibitively large number of images, just to account for responsiveness. To account … Read more

Back End Interface Plugin

You will need an Admin Theme. Despite its name, this should be implemented as a plugin. Here is a basic plugin file: <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Admin Theme */ add_action( ‘admin_init’, ‘t5_admin_theme_init’, 11 ); function t5_admin_theme_init() { $settings = new stdClass; $settings->name=”Clean”; $settings->url = plugins_url( ‘clean.css’, __FILE__ ); … Read more

shortcode not working [closed]

I may have found the problem (from product_attribute) array( ‘per_page’ => ’12’, ‘columns’ => ‘4’, ‘orderby’ => ‘title’, ‘order’ => ‘asc’, ‘attribute’ => ‘asc’, ‘filter’ => ‘asc’ ) [product_attribute attribute=”color” filter=”black”] Notice the attibute is in single quotes wheras yours is in double quotes: do_shortcode (‘[product_attribute attribute=”Grams”]’); also you may need it to be in … Read more

Quote rotator in the sidebar

You don’t need a plugin for that (and I can’t imagine that one would exist for that). A plain simple function, that you call in your sidebar, is enough: The Query function quote_posts_list() { // Retrieve 5 random posts: $posts = get_posts( array( ‘numberposts’ => 5, ‘orderby’ => ‘rand’, ‘tax_query’ => array( ‘taxonomy’ => ‘post-format’, … Read more

Add Products to user’s ID Woocommerce

/* Add to cart product api */ add_action( ‘rest_api_init’, function () { register_rest_route( ‘wp/v2’, ‘add_to_cart_product’, array( ‘methods’ => array(‘GET’,’POST’), ‘callback’ => ‘add_to_cart_product’, ) ); } ); function add_to_cart_product(){ //wp_set_current_user($_POST[‘user_id’]); /*wp_set_auth_cookie($_POST[‘user_id’]);*/ /* Required Parameters $_POST[‘user_id’] $_POST[‘product_id’] */ global $woocommerce,$wpdb; $array = $wpdb->get_results(“select meta_value from “.$wpdb->prefix.”usermeta where meta_key=’_woocommerce_persistent_cart_1′ and user_id = “.$_POST[‘user_id’]); $data =$array[0]->meta_value; $cart_data=unserialize($data); $flag = … Read more

Hide WordPress Plugin Deactivation Links

There is a filter called plugin_action_links that lets you do this. function wpse253902_disable_plugin_deactivation ($actions, $plugin_file, $plugin_data, $context) { if (array_key_exists (‘deactivate’, $actions)) unset( $actions[‘deactivate’] ); return $actions; } There is even a filter plugin_action_links_{plugin_name} that lets you control the links on individual plugins. If you dive into it, you will find out that you can … Read more