Posts

Showing posts with the label wordpress

WooCommerce woocommerce_admin_settings_sanitize_option use

WooCommerce woocommerce_admin_settings_sanitize_option use I'm currently using the action woocommerce_update_option_X to save the settings of my plugin settings page. However, the following error occurs: woocommerce_update_option_X action is deprecated, use woocommerce_admin_settings_sanitize_option filter instead But when I try to find information on that filter, I can't figure out how to use it in my case. In my settings I have a table with fields that has to be saved. The table looks like this: ... <tbody> <?php $max_settings = get_option('max_settings',array()); foreach ( $max_settings as $data ) { ?> <tr> <td><input type="text" value="<?php echo esc_attr( $data['var'] ) ?>" name="max_settings[var]" /></td> <td><input type="text" value="<?php echo esc_attr( $data['productid'] ) ?>" name="max_settings[productid]" /></td> ...

Trying to generate CSV from wordpress custom table

Trying to generate CSV from wordpress custom table I am trying to export data from a wordpress custom table. I have two jquery UI datepicker which represents the start and end date. I'm sending the date filed value via wp ajax with button click. If I pass date values static then the csv generates, but with the value stored inside variables $sdate and $edate does not work. If I pass store static value inside those variables that also works. I can see that ajax function is submitting date field value. Not sure what's wrong with the code. Here is my function: add_action( 'wp_ajax_sharepricedownload', 'sharepricedownload' ); add_action( 'wp_ajax_nopriv_sharepricedownload', 'sharepricedownload' ); function sharepricedownload() { global $wpdb; $sdate=$_REQUEST['sdate']; $edate=$_REQUEST['edate']; // $sdate='2018-06-19'; // $edate='2018-06-19'; $file = 'sharepr...

Google Cloud bucket permission issue

Google Cloud bucket permission issue I have deploy wordpress multiple site on google app engine and now i want to change uploads folder as google bucket folder where i can upload media. Now the following issue i have .. Unable to create directory https://console.cloud.google.com/storage/browser/media-wordpress/. Is its parent directory writable by the server? OR Unable to create directory gs://media-wordpress/. Is its parent directory writable by the server? So how I can make writable for my wordpress site or ananamous users. Sam In this github issue github.com/GoogleCloudPlatform/php-docs-samples/issues/518 it is suggested to use this wordpress.org/plugins/wp-stateless Please read the issue and try the workaround. Let us know how it goes – Victor Herasme Perez 2 days ago 1 Answer ...

WordPress create a user profile page for everyone

WordPress create a user profile page for everyone I am trying to make a user profile page for all WordPress user, so visitor can see each user's profile with their basic information. user is the native Author not a custom post type user Author for example: My custom user profile links https://myexample.com/user/joe/ ---- will show joe's profile https://myexample.com/user/joe/ https://myexample.com/user/jhon/ ---- will show jhon's profile https://myexample.com/user/jhon/ but my code works for only admin/author is there any way to dispaly <?php $ID = the_author_meta('ID'); $first_name = the_author_meta('first_name'); $last_name = the_author_meta('last_name'); $user_fullname = $first_name . ' ' . $last_name; $nickname = the_author_meta('nickname'); $branch_code = the_author_meta('branch_code'); $index_no = the_author_meta('index_no'); $sp_designation = the_author_meta('sp_desi...

Product attribute empty value from order item in Woocommerce 3

Image
Product attribute empty value from order item in Woocommerce 3 I know that there are a lot of questions already for that matter but im not able to figure out how to get a custom product attribute from an woocommerce order. here is what i have try: $order = wc_get_order( $order_id ); $order_data = $order->get_data(); foreach ($order->get_items() as $item_key => $item_values) { $product = $item_values->get_product(); // Get the product $product_id = $item_values->get_product_id(); // the Product id $tokens = get_post_meta($product_id, 'Tokens', true); } I have also try: $tokens = $product->get_attribute( 'Tokens' ); and $tokens = array_shift( wc_get_product_terms( $product_id, 'Tokens', array( 'fields' => 'names' ) ) ); My custom product attribute has the name " Tokens " and the value 5000 but im getting an empty return, what am i doing wrong? That can h...

How to set up a subdomain with CloudFlare & WPEngine?

How to set up a subdomain with CloudFlare & WPEngine? (or if there's a better alternative, any advice is appreciated). Here's the situation: An E-commerce site with ~500 products, each with ~20 photos, so about 10K product photos overall. On previous hosting, we simply had an /images/ folder that was aliased as a subdomain, so any requests for "https://images.example.com/subfolder/image.jpg" would be served from "public_html/images/subfolder/image.jpg". Recently moved to WPEngine, for performance reasons... and I just discovered that they don't do subdomains. Also, WPEngine doesn't do DNS hosting, so I'm using CloudFlare for DNS hosting, which is fine. What is not fine, is that now I have no idea how to handle the subdomain situation. How do normal people handle a situation where (for a variety of reasons) you want to have most of the content on the primary domain, but some content on a subdomain/different domain, while using CloudFlare for D...

Loop to return all Woocommerce product tags in alphabetical order

Loop to return all Woocommerce product tags in alphabetical order i am trying to make a loop in WordPress for woocommerce theme to get out all product tags in alphabetical order in a simple way "heading with A below it all tags starts with A letter etc." i am using the code but its return null <?php $tags = get_tags(); $html = '<div class="post_tags">'; foreach ( $tags as $tag ) { $tag_link = get_tag_link( $tag->term_id ); $html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag- >slug}'>"; $html .= "{$tag->name}</a>"; } $html .= '</div>'; echo $html; ?> 2 Answers 2 You can also use a WP_Term_Query with the Woocommerce product tag custom taxonomy, to get all related terms alphabetically by letter: WP_Term_Query $taxonomy = 'product_tag...

Renaming WooCommerce Order Status

Renaming WooCommerce Order Status I would like to rename the WooCommerce order status from "Completed" to "Order Received". I can edit the script below located in wc-order-functions.php, but I would prefer not to modify any core files or use a plugin. Is it possible to override woocoomerce functions with scripts in child theme's functions.php file? functions.php function wc_get_order_statuses() { $order_statuses = array( 'wc-pending' => _x( 'Pending Payment', 'Order status', 'woocommerce' ), 'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ), 'wc-on-hold' => _x( 'On Hold', 'Order status', 'woocommerce' ), 'wc-completed' => _x( 'Completed', 'Order status', 'woocommerce' ), 'wc-cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ), ...

HTTPS Issue With Mixed Content - ARForms Plugin

HTTPS Issue With Mixed Content - ARForms Plugin I have a site wordpress in HTTPS, but also i have an Mixed Content because of ARForms Plugin. PHP 5.6 fonts.googleapis.com and some images in this plugin unsecure, and that files i cant find in database anf template files, please help me by PHP. Thank you. This is what i found in configuration and this functional not work: $arfsiteurl = home_url(); if (is_ssl() and ( !preg_match('/^https://.*..*$/', $arfsiteurl) or ! preg_match('/^https://.*..*$/', WP_PLUGIN_URL))) { $arfsiteurl = str_replace('http://', 'https://', $arfsiteurl); define('ARFURL', str_replace('http://', 'https://', WP_PLUGIN_URL . '/arforms')); } else { define('ARFURL', WP_PLUGIN_URL . '/arforms'); } 1 Answer 1 You should try to download these scripts locally and enqueue them with your HTTPS secur...

PHP For Each loop with radio buttons as results

Image
PHP For Each loop with radio buttons as results ( Just FYI this function is being used on a Wordpress website in my custom plugin ) This function is supposed to display results as radio buttons based on certain parameters. My problem is, I'm not sure how to insert my ID into a radio button. And I'm not sure how to get multiple radio buttons based on the amount of results I get. There should be one radio button per result. To put this situation into context, this is for an (RPG) Role Playing Game similar to "World of Warcraft", or "EverQuest". A user makes a character by entering a name, race and class into a form. This data is inserted into my database table called "wp_ml_character". On a separate page, this function "ml_skill_select" is called, and is supposed to display all of the user's characters and then display skills to choose from based on the user's selection. Here's how It's supposed to work: It's almost lik...

How to link privacy policy page with the label text on Acceptance Checkbox?

How to link privacy policy page with the label text on Acceptance Checkbox? In my WordPress website, I want the users to be able to view privacy policy of my website as soon they submit any form. I have used Contact Form 7 plugin and within every form (Forms are about 12 - 14 on my website) I have included an Acceptance Checkbox so that users can check it before they submit a form. I want my privacy policy page to be linked with the text Privacy Policy of acceptance checkbox label (I agree to the Privacy Policy.) Is there any way to link that page within [acceptance your-consent] I agree to the Privacy Policy. [/acceptance] form tag? 1 Answer 1 How about: [acceptance your-consent] I consent to your <a href="">Privacy Policy</a>. [/acceptance] [1] https://contactform7.com/acceptance-checkbox/ It works for me. Thanks @TermsFeed. – ...

Change the text of 'View cart' button

Change the text of 'View cart' button Iam using a woocommerce plugin but I got an problem on how to change the text of the view cart button hope there is a one who can help with my problem this is my site this is the image of the text that i want to change the image how can i edit it? all suggestion are appreciated. 4 Answers 4 Add the following to your functions.php file. /** * Change text strings * * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext */ function my_text_strings( $translated_text, $text, $domain ) { switch ( strtolower( $translated_text ) ) { case 'View Cart' : $translated_text = __( 'View Shopping Cart', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'my_text_strings', 20, 3 ); This will change View Cart to View Shopping Cart ...