wordpress-plugin

google analytics custom plugin getting error invalid grant

大憨熊 提交于 2019-11-28 05:35:56
问题 $client = new Google_Client(); $client->setAuthConfigFile(plugin_dir_url( __FILE__ ) . '/client_secrets.json'); $client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob'); $client->addScope(Google_Service_Analytics::ANALYTICS_READONLY); $client->setIncludeGrantedScopes(true); $client->setAccessType('offline'); $client->revokeToken(); $auth_url = $client->createAuthUrl(); using a popup authentication with javascript and then if (!isset($_SESSION['access_token'])) { //$client->authenticate($_GET[

Register/login user with Wordpress JSON API

笑着哭i 提交于 2019-11-28 05:07:02
I want to create mobile app for one wordpress website. I have integrated the wordpress json plugin . I'm not sure where I can find service for user registration and login. Please advice. Salam El-Banna To register a user this will show you exactly how to register one on the database by simply calling a url and adding data to it using GET Method . Now to do so from a mobile app you just have to make an http request to a url containing all the data required for the user. This will show you how to make a request from Android. This is just for registering users there will be another plugin JSON

Removing rel canonical added by Yoast SEO plugin

只谈情不闲聊 提交于 2019-11-28 03:21:54
问题 Couldn't find a solution after a quick google so thought i'd pop a quick post on here. Trying to remove a automatically added rel=canonical link (which is added by Wordpress SEO plugin - by Yoast). I actually want google to crawl each of the different subs even though it may not move away from the parent page. 回答1: rel="canonical" has nothing to do with crawling. It has to do with indexing and prevents the same page from indexing twice or more. Anyway, if you still want to do this you can do

how to load Javascript in Wordpress Plugin

半世苍凉 提交于 2019-11-27 22:53:10
Can someone show me how to include this javascript file into my wordpress plugin. I have tried all the wp_enqeue_script() methods but nothing happens. ok here is my example plugin code with comments explaining what I would like. <?php /* Plugin Name: Ava Test Plugin URI: http://#.com Description: A plugin that is used for my javascript tests Author: Ronny Kibet Author URI: http://ronnykibet.com version: 1.001 */ include(popup.js); /*when I include it this way, it works fine, but gives an error when I activate the plugin 'plugin generated 453 characters ...' */ function popup() { $src = plugins

Woocommerce add to cart button redirect to checkout

核能气质少年 提交于 2019-11-27 21:55:54
I created an ecommerce using the plugin woocommerce. I am selling only a subscription so the "/cart/" page is useless. I'm trying to get rid of it so that when my customer click on "Add to cart" button, he ends up on the checkout page. Ewout you can use a filter in functions.php: add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); function redirect_to_checkout() { global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url(); return $checkout_url; } it doesn't seem to work with ajax, but it works from the single product pages, which I think is what you use On the latest

Add a fee to WooCommerce per product, based on category

时间秒杀一切 提交于 2019-11-27 20:55:40
I've been trying for a while now to get this working but I haven't find any solution that does exactly what we need, and I'm far from an expert in PHP so I'm a bit lost. We use WooCommerce and WooTickets. The goal is to add a 5% fee for "Service Fee" only to products in the "Tickets" category (ID:34). We have found this code snipper, that add a fixed cost based on a product category : // Add Service Fee to Category function woo_add_cart_fee() { $category_ID = '23'; global $woocommerce; foreach ($woocommerce->cart->cart_contents as $key => $values ) { // Get the terms, i.e. category list using

Wordpress REST API (wp-api) 404 Error

非 Y 不嫁゛ 提交于 2019-11-27 19:19:54
I have been using the Wordpress REST plugin WP-API for months now while developing locally with XAMPP. I recently migrated my site to an EC2 instance and everything is working fine except I now get a 404 with the following message whenever I try to access any endpoint on the API: The requested URL /wordpress/wp-json/ was not found on this server Pretty permalinks are enabled with the following structure http://.../wordpress/sample-post/ which works fine when navigating to a specific post in the browser. Here are some details about my setup: Wordpress 4.4.1 Not a Multisite WP REST API plugin 2

social content locker for blogger.com blogs? is it possible

穿精又带淫゛_ 提交于 2019-11-27 18:35:39
问题 How can I integrate social content locker in blogger blogs? We see in numbers of WordPress blogs and websites, But in blooger.com blogs you see no plugin option does anybody has another way or something like this? I Want visitor to like, tweet or g+ before reading my posts. thanks 回答1: I found this working script for this what you need to do is first backup you template. then edit HTML >search <head> tag and put this code after <head> <script src='http://code.jquery.com/jquery-1.10.2.min.js'

WordPress, jQuery UI CSS Files?

ぃ、小莉子 提交于 2019-11-27 17:12:01
问题 I'm trying to create a WordPress plugin, and I would like to have jQuery UI Tabs in one of my settings pages. I already have the scripting code set: wp_enqueue_script('jquery'); // Enque jQuery wp_enqueue_script('jquery-ui-core'); // Enque jQuery UI Core wp_enqueue_script('jquery-ui-tabs'); // Enque jQuery UI Tabs ...and I have created the HTML and JavaScript too. Until here all are fine. The question is: The WordPress platform comes with some scripts already pre-installed like the one I have

Contact Form 7: use hook created using wpcf7_before_send_mail for only one contact form by id

半城伤御伤魂 提交于 2019-11-27 16:24:09
问题 I am working on a site with several forms created using Contact Form 7. For one of these forms, I am passing variables that I collected using a hidden input field in the form. I am passing these variables into the email using the wpcf7_before_send_mail hook, but these values are passing into every email (I added dynamic variables as well as static text) Here's the code: add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' ); function wpcf7_add_text_to_mail_body($contact_form){