lundi 29 février 2016

This video importer code is not working I do not know why

<?php
$searchqry = $_GET['searchqry'];
$thePage = $_GET['page'];
$cat = $_GET['category_id'];
$curl_connection = curl_init();
if(empty($searchqry) && empty($cat)){
    $url = "http://ift.tt/1TNpqNy".$thePage;
}elseif(empty($searchqry) && !empty($cat)){
    $url = "http://ift.tt/1oLeDrf".$cat."&page=".$thePage;
}elseif(empty($cat)){
    $url = "http://ift.tt/1TNpoVT".$searchqry."&page=".$thePage;
}else{
    $url = "http://ift.tt/1TNpoVT".$searchqry."&filter_category=".$cat."&page=".$thePage;
}
curl_setopt($curl_connection, CURLOPT_URL, $url);
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($curl_connection, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_connection, CURLOPT_HEADER, true);
curl_setopt($curl_connection, CURLOPT_REFERER, "http://www.abcd.com/");
$result = curl_exec($curl_connection);
echo $result;

?>

I tried again and again to just scrape video page and categorywise but I am unable to find a solution unfortunately.



via Chebli Mohamed

Filter currency in wocoommerce and convert it from usd to inr for ccavenue

I am using ccavenue payment gateway on my wordpress site.
Plugin url is http://ift.tt/1neK8sI
But i am having one issue that my base currency is inr and ccavenue accepts payment in inr only, so when user switch the currency to usd then ccavenue is taking $40 as inr40.
I want to convert the currency before getting it to ccavenue page.
The code snippet for the same is.

 public function generate_ccavenue_form($order_id){

        global $woocommerce;
        $order = new WC_Order($order_id);
        $redirect_url = ($this -> redirect_page_id=="" || $this -> redirect_page_id==0)?get_site_url() . "/":get_permalink($this -> redirect_page_id);
      //For wooCoomerce 2.0

        $redirect_url = add_query_arg( 'wc-api', get_class( $this ), $redirect_url );
        $order_id = $order_id.'_'.date("ymds");
        $checksum = $this -> getCheckSum($this -> merchant_id, $order->order_total, $order_id, $redirect_url, $this -> working_key);


        $ccavenue_args = array(
            'Merchant_Id' => $this -> merchant_id,

            'Amount' => $order->order_total,
            'Order_Id' => $order_id,
            'Redirect_Url' => $redirect_url,
            'Checksum' => $checksum,
            'currency_code' => get_woocommerce_currency(),

            'billing_cust_name' => $order -> billing_first_name .' '. $order -> billing_last_name,
            'billing_cust_address' => $order -> billing_address_1,
            'billing_cust_country' => $order -> billing_country,
            'billing_cust_state' => $order -> billing_state,
            'billing_cust_city' => $order -> billing_city,
            'billing_zip' => $order -> shipping_postcode,
            'billing_cust_tel' => $order -> billing_phone,
            'billing_cust_email' => $order -> billing_email,
            'delivery_cust_name' => $order -> shipping_first_name .' '. $order -> shipping_last_name,
            'delivery_cust_address' => $order -> shipping_address_1,
            'delivery_cust_country' => $order -> shipping_country,
            'delivery_cust_state' => $order -> shipping_state,
            'delivery_cust_tel' => $order -> shipping_phone,
            'delivery_cust_notes' => '',
            'Merchant_Param' => '',
            'billing_zip_code' => $order -> billing_postcode,
            'delivery_cust_city' => $order -> shipping_city,
            'delivery_zip_code' => $order -> shipping_postcode
            );

        $ccavenue_args_array = array();
        foreach($ccavenue_args as $key => $value){
            $ccavenue_args_array[] = "<input type='hidden' name='$key' value='$value'/>";
        }

I think i have to add a filter hook for this in function.php. But i am not able to made and add a filter for this.



via Chebli Mohamed

Storing data in MySQL Database in wordpress

How to insert data into MySQL database in Wordpress and how to get all values from the database?



via Chebli Mohamed

wp_remote_post for formidable form in a plugin

I have created a WordPress plugin to post a Formidable Form rather than using a url referrer and $_GET.

add_action('frm_after_create_entry', 'PQPCustomFormPosts', 30, 2);

function PQPCustomFormPosts($entry_id, $form_id){
 if($form_id == 8){ //id of the Contact form
    $args = array();
    if(isset($_POST['item_meta'][106])) 
      $args['FirstName'] = $_POST['item_meta'][106];  
    if(isset($_POST['item_meta'][107]))
      $args['LastName'] = $_POST['item_meta'][107]; 
    if(isset($_POST['item_meta'][118])) 
      $args['Company'] = $_POST['item_meta'][118];  
    if(isset($_POST['item_meta'][115])) 
      $args['EmailAddr'] = $_POST['item_meta'][115];  
    if(isset($_POST['item_meta'][119]))
      $args['Subject'] = $_POST['item_meta'][119]; 
    if(isset($_POST['item_meta'][117])) 
     $args['Message'] = $_POST['item_meta'][117];  
    if(isset($_POST['item_meta'][116])) 
      $args['op'] = $_POST['item_meta'][116];  
    $result = wp_remote_post('http://ift.tt/21xSr5N', array('body' => $args));
    print_r($result );
    }
}

This works fine like this with the print_r($result) the php is called after the print_r($result). However if I remove the print_r($result) it doesn't work it stays on the same page. Not sure why that would be.

This is the result of the print_r($result):

Array ( [headers] => Array ( [date] => Tue, 01 Mar 2016 01:31:51 GMT [server] => Apache [vary] => Cookie [link] => ; rel="https://api.w.org/", ; rel=shortlink [connection] => close [content-type] => text/html; charset=UTF-8 ) [body] =>



via Chebli Mohamed

How to prevent downloads via the source code on a webpage

I have created an online course. The content is only available to members who have purchased the course. I use optimizepress as a wordpress plugin to build my pages and this plugin also features an access restriction widget for non members.

But a member could still technically login, go to a page, view the source code and download the content (mp3, mp4) directly via the url links in the HTML. I wish to avoid that and protect my content from being pirated.

How can I hide those url's in the code, or is there a way to disable a user from viewing the source?

Does anybody have an idea on how to prevent those kinds of downloads?

Note: My site is hosted by Dreamhost



via Chebli Mohamed

How to get to work input multiple in Contact Form 7 or some other plugin or Wordpress wp_mail?

Good night. And until I start, i want to apologize for my poor English.

So, at site i have the contact form which use CF7 handler. By design my feedback mail form should be able send several attachments (3-4 images) to my email, but unfortunately after some tries do this i understand that the CF7 can't work with input multiple (plugin able to add just one by one attachments, not at all in multiple selection), and i dont know how fix it.

Maybe someone who already had similar issue and find an answer can advice some alternative variant (another plugin fo example or some code).

Thank you.



via Chebli Mohamed

How can I overwrite the function code of a WP plugin (WPML)?

I need help please overwritting a WPML function which outputs the rel-alternate-hreflang tag. Ideally you would provide me a function that I can place in my child themes function.php file.

I am using the popular WPML (WordPress Multi Language) plugin to manage multiple languages on a WP Multi site. I have one site (Canadian) that is English and French, and other site (USA) that is English and Spanish. I am wanting to tell Google about the other site with respect to implementing the rel-alternate-hreflang tag. This should help Google direct Canadians to the Canadian equivalent page and vice-versa for US visitors. Currently the WPML plugin (which manages BOTH sites in the multisite) outputs ...

On the USA web site ....

<link rel="alternate" hreflang="en-US" href="http://ift.tt/1KZJTNY" />
<link rel="alternate" hreflang="es" href="http://ift.tt/1QhALTA" />

On the Canadian web site ....

<link rel="alternate" hreflang="en-CA" href="http://ift.tt/1KZJWsS" />
<link rel="alternate" hreflang="fr" href="http://ift.tt/1QhALTA" />

BUT I WANT IT TO OUTPUT ...
(note the English page names are identical, the only difference is the /ca/. I can not do anything about the USA site knowing the name of the French page or the Canadian site knowing the Spanish page name. That information would not be available in each multisite database. However the CAN vs USA pagename urls are a simple calculation once the href link has been extracted)

On the USA web site ....

<link rel="alternate" hreflang="en-US" href="http://ift.tt/1KZJTNY" />
<link rel="alternate" hreflang="es" href="http://ift.tt/1QhALTA" />
<link rel="alternate" hreflang="en-CA" href="http://ift.tt/1KZJWsS" />

On the Canadian web site ....

<link rel="alternate" hreflang="en-CA" href="http://ift.tt/1KZJWsS" />
<link rel="alternate" hreflang="fr" href="http://ift.tt/1QhALTA" />
<link rel="alternate" hreflang="en-US" href="http://ift.tt/1KZJTNY" />

I tried asking for tech support from WPML but did not get the help I was hoping for. So I found the function that creates this output in the file "wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php". I don't want to hack this file as the plugin gets updated regularly. So hopefully we can override it, if possible. Note this same script outputs BOTH the USA and Canadian output so we also need to figure out first which output it is creating before we can calculate the CAN vs USA equivalent page.

The function code looks like this ...

function head_langs()
{
    $languages = $this->get_ls_languages( array( 'skip_missing' => true ) );
    // If there are translations and is not paged content...

    //Renders head alternate links only on certain conditions
    $the_post = get_post();
    $the_id   = $the_post ? $the_post->ID : false;
    $is_valid = count( $languages ) > 1 && !is_paged() && ( ( ( is_single() || is_page() ) && $the_id && get_post_status( $the_id ) == 'publish' ) || ( is_home() || is_front_page() || is_archive() ) ); 

    if ( $is_valid ) {
        foreach ( $languages as $code => $lang ) {
            $alternate_hreflang = apply_filters( 'wpml_alternate_hreflang', $lang[ 'url' ], $code );
            printf( '<link rel="alternate" hreflang="%s" href="%s" />' . PHP_EOL,
                    $this->get_language_tag( $code ),
                    str_replace( '&amp;', '&', $alternate_hreflang ) );
        }
    }
}

Can this be done? Alternatively I was wondering if there was a way to find these tags with jQuery, get the page link, add "/ca" or remove it and insert the extra tag with the corresponding hreflang. But this is a question for a different post I suspect. My thought is the above solution I am looking for would be a better way to go.

Thanks for your assistance!



via Chebli Mohamed

Image missing and required - Wordpress AMP Structure doesn't add Image attribute

When validating my wordpress posts using Google's Structured Data Testing Tool, I get the following error:

"Image: missing and required"

I have the official wordpress AMP plugin installed that generated the AMP pages for me. The problem is that it doesn't popular the "image" attribute for BlogPosting.

In the plugin there is a code that I think should generate it, but it's not running anywhere:

private function get_post_image_metadata() {
    $post_image_meta = null;
    $post_image_id = false;

    if ( has_post_thumbnail( $this->ID ) ) {
        $post_image_id = get_post_thumbnail_id( $this->ID );
    } else {
        $attached_image_ids = get_posts( array(
            'post_parent' => $this->ID,
            'post_type' => 'attachment',
            'post_mime_type' => 'image',
            'posts_per_page' => 1,
            'orderby' => 'menu_order',
            'order' => 'ASC',
            'fields' => 'ids',
            'suppress_filters' => false,
        ) );

        if ( ! empty( $attached_image_ids ) ) {
            $post_image_id = array_shift( $attached_image_ids );
        }
    }

    if ( ! $post_image_id ) {
        return false;
    }

    $post_image_src = wp_get_attachment_image_src( $post_image_id, 'full' );

    if ( is_array( $post_image_src ) ) {
        $post_image_meta = array(
            '@type' => 'ImageObject',
            'url' => $post_image_src[0],
            'width' => $post_image_src[1],
            'height' => $post_image_src[2],
        );
    }

    return $post_image_meta;
}

How can I populate the image tag for each post using this AMP Wordpress plugin? I want the page to pass the Sturctured Data Testing Tool, so he can pass the AMP validation as well.



via Chebli Mohamed

How to make a sum of number fields to single field in contact form 7 in wordpress

below is the code of table in contact form 7,

<table>
<tr>
<th>RX #</th>
<th>Amount</th>
</tr>
<tr>
<td>[number RX1 placeholder "RX1"]</td>
<td>[number RX1Amount placeholder "RX1 Amount"]</td>
</tr>
<tr>
<td>[number RX2 placeholder "RX2"]</td>
<td>[number RX2Amount placeholder "RX2 Amount"]</td>
</tr>
<tr>
<td>[number RX3 placeholder "RX3"]</td>
<td>[number RX3Amount placeholder "RX3 Amount"]</td>
</tr>
<tr>
<td>[number RX4 placeholder "RX4"]</td>
<td>[number RX4Amount placeholder "RX4 Amount"]</td>
</tr>
<tr>
<td>[number RX5 placeholder "RX5"]</td>
<td>[number RX5Amount placeholder "RX5 Amount"]</td>
</tr>
<tr>
<td>Total Amount</td>
<td>[number TotalAmount]</td>
</tr>
</table>

i want sum the amount column in such a way that when i enter number/amount in any of the field it should be updated in last total row, if i enter number/amount in more than one row, sum of all rows should be updated in last total row.

can any one help me out?



via Chebli Mohamed

Pods 2.x orderby plain number (numerical order, not alpha)

Does anyone know how to force the WP Pods plugin to correctly sort records in numerical order? The field I'm sorting by is a "Plain Number" field, but the following code yields records sorted alphabetically (i.e. 1, 10, 11, 12, 13, 2, 3, 4, etc.):

$params = array(
    'where' => "work.ID = '".$rep_id."'",
    'orderby' => 'sortnum ASC',
);
$pod_role = pods('repertoire_role', $params );

while ( $pod_role->fetch() ) {
    $roles[] = array('ID' => $pod_role->field('ID'), 'role' => $pod_role->field('role') );
}

I tried using additional parameters as in a WP_Query, e.g.:

'orderby'   => 'meta_value_num',
'meta_key'  => 'sortnum',

And also tried:

'orderby' => 'sortnum ASC',
'meta_type' => 'NUMERIC'

...but the first of those resulted in SQL errors and the second had no effect at all. Any help would be much appreciated!

By the way, has anyone else had issues with the Pods website forum? I tried to log in using both Google+ and Wordpress.com credentials, but the first resulted in an error message, and the second appeared to work at first but then redirected me to the login form....



via Chebli Mohamed

How to add a editable region to the Wordpress TinyMCE editor

Im wondering if anyone knows of a way to create an editable region on content in the wordpress TinyMCE editor? I have a plugin that creates a custom style and then adds it to a user selected area in the editor. After this, I would like for the user to be able to select that content and have a selection box pop up like with wordpresses gallery. It could then change data attributes of the given regions class that was added. Thanks in advance!



via Chebli Mohamed

Advanced Custom Field Content doesn't show in wordpress loop

I'm having a bit of trouble getting acf content to show within the Wordpress loop. The code I'm using within the page.php template is as follows:

<?php $args = array (
'post_type' => 'test-box'
);
$the_query = new wp_query ( $args);
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query-   >the_post(); ?>

<?php 
the_field( 'acf_test_box_header' );
the_field( 'acf_test_box_content' );
?>

<?php endwhile; else : ?>

<p>There are no posts to display.</p>

<?php endif; ?>

The problem is that the two fields: acf_test_box_header and acf_test_box_content don't display their content when inside the loop, returning instead 'header 2' and 'content 2'. If I move them outside the loop then they display the content as it was entered fine.

Any ideas?



via Chebli Mohamed

how to implement in wordpress a signup flow that requires a secret activation code

I'm trying to implement a signup flow in wordpress with the additional requirement that a user, to sign up, must use a secret activation code. Such code is valid only once, it's consumed after signup.

Many such codes are available (manually imported in DB is fine).

The use case is to let sign up only users who bought a (paper) book containing the secret activation code. In each book, the code will be different.

Before writing the whole thing manually, is there a plugin with a similar functionality? If not, what is the suggested implementation strategy?



via Chebli Mohamed

WP Plugin Header Warning

I've been working on a simple plugin to modify the standard wp_editors. Everything works correctly, but I'm getting a strange error anytime I try to "save" my changes (Options - Settings API). I've read a lot of possible solutions to this issue, but I'm having a hard time finding a solution as I think is very specific to my plugin.

Here is a snippet of my code to establish some context (I removed some sections as its not necessary to show the full code)

<?php
/*
Plugin Name: mmm-editor
Plugin URI:  ---
Description: Customization for backend editors
Version:     1.0
Author:      Mateo Marquez
Author URI:  ---
License:     GPL2
License URI: http://ift.tt/XUg0iV
Domain Path: /languages
Text Domain: mmm
*/

//include & register fields
require_once('includes/mmm-settings.php');

//include fields functions
require_once('includes/mmm-fields.php');

//include tiny functions
require_once('includes/mmm-tiny.php');

//include ACF functions
require_once('includes/mmm-acf.php');


//add_action( 'admin_menu', 'mmm_add_admin_menu' );
add_action( 'admin_init', 'mmm_settings_init' );


function mmm_add_admin_menu(  ) {

    add_options_page( 'mmm-editor', 'WYGIWYS Options', 'manage_options', 'mmm-editor', 'mmm_options_page' );

}

function mmm_stylesheet( ) {
    wp_enqueue_style('admin-css', plugins_url('/assets/admin-styles.css', __FILE__));
    wp_enqueue_script('admin-js', plugins_url('/assets/admin-scripts.js', __FILE__), array('jquery'), '20120206', true );
}
add_action( 'admin_print_styles', 'mmm_stylesheet' );




function mmm_options_page(  ) {

    ?>
    <form action='options.php' method='post'>
        <div class="mmm-header">
            <h2>WYSIWYG Editor Options</h2>
        </div>

        <div class="sections">
            <?php
            settings_fields( 'globalEditor' );
            do_settings_sections( 'globalEditor' );
            ?>
        </div>


        <div class="sections">
            <?php
            settings_fields( 'topicsEditor' );
            do_settings_sections( 'topicsEditor' );
            ?>
        </div>

        <div class="sections">
            <?php
            settings_fields( 'forumsEditor' );
            do_settings_sections( 'forumsEditor' );
            ?>
        </div>

        <div class="sections">
            <?php
            settings_fields( 'blogsEditor' );
            do_settings_sections( 'blogsEditor' );
            ?>
        </div>

        <?php
        submit_button();
        ?>

    </form>
    <?php

}

Here is the error dialog that appears any time I try to "Save/submit" my form with the settings slected. Keep in mind this only happens when I got define('WP_DEBUG',true);. It doesn't seem to affect the behavior of my plugin ( I just have to reload or go back to access the settings page again -- but changes are saved). Even though this work, I don't want to use something with warnings in production. Here is the exact warning log:

Warning: Cannot modify header information - headers already sent by (output started at /Users/mmarquez/Sites/_______/wp-includes/functions.php:3792) in /Users/mmarquez/Sites/______/wp-includes/pluggable.php on line 1228

Any assistance is appreciated - I know this is a common question, but I've tried most of the other suggestions around.

Thanks!



via Chebli Mohamed

Yoast SEO (Wordpress) is not reading my custom page content

Recently i have taken to using Wordpress for certain CMS tools.

I am a HTML/PHP/JS guy so prefer to code it all my self, however, yoast plugin doesnt see the content that is placed directly in the core template file.

The page is looking great, however id idealy like to have some form of code that allows the content to be seen (if possible) I dont mind placing the code in the page using wordpress rather than hardcoding in the core template, but when i do, nothing shows.

So far things are working great, but this is a problem as id rather keep it clean and use wordpress's page setup.

I have the header/footer setup using the <?php get_header(); ?> function. Is there a "content" option?

anyone having a similar problem? anyone shed some light?



via Chebli Mohamed

Calling a Wordpress function out of class

I have a woocommerce plugin that has a class Foo:

class WC_Foo extends WC_Shipping_Method{
    function sayHello(){
        echo "Hello";
    }
}

I want to call sayHello() out of the Foo class:

function bar(){
    WC_Foo->sayHello();
}

But I get this error:

Fatal error: Call to a member function `sayHello` on a non-object.



via Chebli Mohamed

Want to add negative marking feature in WP Viral Quiz Plugin

Want to show customized result output of quiz. In results, I want to add a feature that deducts marks for negative answers. Let say (-1) for each wrong question. Please help. Along with this, I want to add a timer in the quiz so that we can create time based online tests.



via Chebli Mohamed

dimanche 28 février 2016

Target Specific Product when calling woocommerce_after_shop_loop_item

I am trying to change the add to cart functionality on the product archive/shop page on woocommerce based on a custom field using woocommerce_after_shop_loop_item. However if only even one item with the custom field exists on the page the code will effect all products even the ones without the custom field. And I completely understand why this is happening. My question is, is there any way to only apply the action to that one specific product.

/*STEP 1 - REMOVE ADD TO CART BUTTON ON PRODUCT ARCHIVE (SHOP) */

function remove_loop_button(){
 global $post;

 if($post->my_custom_field)
 {
  remove_action( 'woocommerce_after_shop_loop_item',
 'woocommerce_template_loop_add_to_cart', 10 );
 }

}
add_action('init','remove_loop_button');



/*STEP 2 -ADD NEW BUTTON THAT LINKS TO PRODUCT PAGE FOR EACH PRODUCT */

add_action('woocommerce_after_shop_loop_item','replace_add_to_cart');
function replace_add_to_cart() {
 global $product, $post;

 if($post->my_custom_field)
 {
   $link = $product->get_permalink();
   echo do_shortcode('<a href="'.$link.'" class="button addtocartbutton">View Product</a>');
 }

}



via Chebli Mohamed

How to use AWF ( Akeeba Web Framwork ) as Wordpress plugin?

I'm new to Wordpress.

I like to use Wordpress with AWF plugin.

But in GitHub, there is no such Doc are available.

So Please give me solution for Installing and Using AWF in Wordpress.



via Chebli Mohamed

wordpress json_decode is not working, I am trying to get value form wp_option table , please help me

/* when I am trying decode json with this code I output is ArrayArray ( [0] => ) I do not why wordpress does not supporting, */

 <?php
    global $wpdb;
    $mylink = $wpdb->get_results( "SELECT option_value FROM wp_options WHERE option_id=62167", ARRAY_N );
    $raw = stripslashes_deep($mylink);
            $data = array();
            foreach ($raw as $json) {
                        echo $json;

                $item = @json_decode($json, true);

                $data[] = $item;enter code here

                            print_r($data);

            }
    ?>
    enter code here



via Chebli Mohamed

Wordpress forms plugin like this?

Can anyone tell me if there is a forms plugin that behaves like this in Wordpress? http://ift.tt/1QF7Wh2

I love the way the options zoom in on hover and how it moves to the next page after making a selection. I'm not a developer so I need something on the front-end. TIA!



via Chebli Mohamed

Create Wordpress plugin page, similar to posts page

My plugin have specific information in itself table. I want this information to be loaded at similar wordpress posts page.

how can i to do this ?



via Chebli Mohamed

I am struggling with one thing in shipping classes and I haven't been able to find the answer on these forums

I am struggling with one thing in shipping classes and I haven't been able to find the answer on these forums. I would like to be able to add a fixed cost per additional item in the cart. eg. If someone buys one item the shipping cost is £2.95 If someone buys 2 items, the cost is £3.95 (the shipping class amount plus a fixed amount for extra items) If someone buys 3 items, the cost is £4.95 (the shipping class amount plus 2 times the fixed amount for extra items) I hope this makes sense :?



via Chebli Mohamed

Why the oputput of an image gallery plugin is not displayed into a page of my WordPress custom theme?

I am pretty new as WordPress developer and I am going crazy with a theme developed by myself starting from 0.

So, at this link you can download the entire theme so you can see in the details the entire code: http://ift.tt/1RwZCDl

On this website I have tryed to install an image gallery plugin named GMedia Gallery (I have tryed also with other plugin and I have similar problem), this one: http://ift.tt/1UrVkji

With this plugin I create a gallery and then going into the:

Appereance --> Menu --> GMedia Gallery ---> My Gallery I add the created gallery as a page into my main menu.

And here I have a big problem because, using my custom theme, clicking on the related link into the main menu, the gallery is not shown and the page appera empty, as you can see here:

http://ift.tt/1RwZCDn

I am pretty sure that this is an issue related to my theme because switching to any of the default WordPress theme (for example Twenty Twelve) the gallery is perfrectly shown into the page, here a screenshot that proves this asserion:

enter image description here

So the problem have to be related to my custom theme because using another theme it works fine !!!

I really have no idea about the reason of this problem. I thinked that maybe coul depend by the fact that I have customized the content-page.php file or that it could be related by some JQuery issue.

In the specific case, as you can see opening the theme project, I have added JQuery into the /assets/js/ directory and then I have add the JQuery support to the theme into the function.php file, in this way:

/* Function automatically executed by the hook 'load_java_scripts':
 * 1) Load all my JavaScripts
 */
function load_java_scripts() {

    // Load JQuery:
    wp_enqueue_script('jquery');
    // Load FlexSlider JavaScript
    wp_enqueue_script('flexSlider-js', get_template_directory_uri() . '/assets/plugins/flexslider/jquery.flexslider.js', array('jquery'), 'v2.1', true);
    // Load bootstrap.min.js:
    wp_enqueue_script('bootstrap.min-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array('jquery'), 'v3.0.3', true);

    // Load FancyBox:
    wp_enqueue_script('fancy-js', get_template_directory_uri() . '/assets/plugins/fancybox/jquery.fancybox.pack.js', array('jquery'), 'v2.1.5', true);
    // Load scripts.js:
    wp_enqueue_script('myScripts-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '1.0', true);
    // Load Modernizer:
    wp_enqueue_script('myodernizer-js', get_template_directory_uri() . '/assets/js/modernizr.custom.js', array('jquery'), '2.6.2', true);

}

add_action('wp_enqueue_scripts', 'load_java_scripts');

But I am not so sure that it is correct because when I do:

// Load JQuery:
wp_enqueue_script('jquery');

I am not specifying the path of the jquery.js file, so what is exactly doing? (I have do it many times ago).

So what could be the problem? How can I try to fix it?

Tnx so much



via Chebli Mohamed

Different Taxonomy menu order for each custom post type

i have a custom post type with a custom taxonomies associated. i' d like set a different menu order of my custom taxonomy for each post type.

For example:

i have 2 post:

Post A & Post B with same 2 taxonomy associated: Term A & Term B

I'd like that

for Post A the order is:

  • Term A
  • Term B

for Post A the order is:

  • Term B
  • Term A

How can i do it ?

Thanks



via Chebli Mohamed

WORDPRESS: remove images from entries in category loop

To customize single page template I'm using the_content hook. The problem is that this hook make changes on single post template but not on archive page. So could you help me to customize entries template on archive page without editing files from activated theme?

For example: remove image and add edit button to entry using only plugin.

Huge thanks for any help!

PS: template_include filter doesn't work for me because it changes whole archive template and I need to customize only entries template.



via Chebli Mohamed

Wordpress rest api returning an empty JSON result

On my wordpress site the Wordpress Rest API plugin used to work correctly and return all posts when I went to:

/wp-json/wp/v2/posts

but now it returns an empty json []

I know this is very little info to go on but what are the usual suspects when troubleshooting such an issue?

Some history on how we got into this mess: The staging environment was copied to live just before the issue occurred. - Some changes were made to theme.php and function.php. Those changes have since been removed in trying to figure out why the endpoint is returning an empty json - I have created new posts and they don't show up - There is no error on console.log



via Chebli Mohamed

samedi 27 février 2016

What Contact Form 7 action should I hook into for seed submitted data AFTER validation and spam filters?

I'm building an API Integration with a Wordpress Plugin that forwards from's data to CRM's API.

I've got it working on Contact Form 7 by adding an action after 'wpcf7_submit'.

// wpcf7_submit available since ContacForm7 4.1.2, testes with 4.4
add_action("wpcf7_submit", "crm_forward_cf7_to_crm", 10, 2); 

function crm_forward_cf7_to_crm($form,$result) {

  // TODO has spam been filtered already?
  // TODO has form been validated already?

  $submission = WPCF7_Submission::get_instance();
  if ( $submission ) {
    $posted_data = $submission->get_posted_data();
    $posted_data = crm_filter_cf7_data($posted_data);
    crm_post_form($posted_data);
  }
};

My questions are:

Has this submission been filtered out by spam validation (e.g.: akismet) at this point?

Has CF7 validated this form at this point?



via Chebli Mohamed

Import Products in wordpress

I am new to WordPress. I want to import the products from the website http://ift.tt/P90LE1 to my wordpress theme . I didn't find the solution of this problem.



via Chebli Mohamed

Is there some way to insert custom archive loop to any theme from plugin?

I'm coding plugin that create custom post type with custom fields. Now I need to build custom archive/category/tag templates which should contain custom fields.

The problem is that I couldn't insert template part inside archive loop from plugin.

Is there some hook to insert custom loop inside activated theme? Something like this:

add_filter('the_content', 'change_content_in_single_post');

Now I'm using this hook:

add_filter( 'template_include', 'change_all_archive_template' );

... but it have changed all page and if I change theme I need to change code in plugin :(

Do you know how to code plugin (template part) more compatible with wp themes?

Huge thanks for any help!



via Chebli Mohamed

How can redirect another page searching zip code value get successful ?

I am find value zip code is available or not try http://ift.tt/1T32Em7 this plug in when get zip code is available then few second after how can redirect anoter page ?

note: in this code header() function is not work.

protected function handleRequests()

{
    global $wpdb;

    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : null;
    if( !$task )
        return false;

    if( $task == 'wc_check_delivery' || $task == 'wc_check_delivery2'  )
    {
        $ops = get_option('wc_cd_settings', array());
        if( !is_array($ops) )
            $ops = array();

        $code = trim($_GET['code']);
        $query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code = '$code' LIMIT 1";
        $row = $wpdb->get_row($query);

        if( !$row )
        {
            $query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code LIKE '%*' AND SUBSTRING(code,1,LENGTH(code-1)) = SUBSTRING('$code',1,LENGTH(code-1))  AND LENGTH(code) <= LENGTH('$code') LIMIT 1";

            $row = $wpdb->get_row($query);
            if( !$row )
            {
                $query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code LIKE '%?' AND SUBSTRING(code,1,LENGTH(code-1)) = SUBSTRING('$code',1,LENGTH(code-1)) AND LENGTH(code)= LENGTH('$code') LIMIT 1";

                // $query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code LIKE '$code%' AND   code LIKE '%*' LIMIT 1";
                $row = $wpdb->get_row($query);
                if( !$row )
                {
                    if($task=="wc_check_delivery2")
                        die('false');
                    $msg = (isset($ops['error_msg']) && !empty($ops['error_msg'])) ? $ops['error_msg'] : __('Oops! This Zip/Pin code is not found');
                    die($msg);
                }
            }
        }
        //print_r($row);

        $time = time();
        $d_time = $time + ($this->_day_seconds * $row->days);
        $msg = sprintf(__('Estimated Delivery in %d days (by %d %s, %d)'), $row->days, date('d', $d_time), date('M', $d_time), date('Y', $d_time)) . '<br/>';


        if( !empty($row->note) )
                $msg .= sprintf(__('Note: %s'), $row->note) . '<br/>';

        die($msg);


    }
}



via Chebli Mohamed

How do I create a 360 Virtal Tour gallery in Wordpress?

How do I create a 360 Virtal Tour gallery in Wordpress? Virtual Tours are in html format. What plugin/widget is required to make a gallery(html)



via Chebli Mohamed

vendredi 26 février 2016

visual composer row id not working

I'm trying to create local links on a wordpress page (anchored sections on the page) and I see that visual composer has a row ID field. I've seen examples of using that field to create link-able sections via visual composer, but when I use that row id field none of my local anchor tags work and the ID for that row in the dom(dev tools inspected) is not the one I entered in the row ID field, but instead it's an ID starting with fws_ and then proceeded by a long string of numbers.

I have a workaround for this which is to append a raw html element to a column of that row, but that seems sloppy, I would rather use VC for this if possible. does anyone know if this fws_****** id is some kind of conflict (I wouldn't think so since the element is generated by VC) or is VC messed up or corrupted?



via Chebli Mohamed

How can I display posts like these in the picture

I want something like that. Do I need a plug-in or can I just do it without a plugin?

http://ift.tt/21noTHW



via Chebli Mohamed

Making list of spas [on hold]

I want to make a list of spas, but I dont have any good ideas or good plugin. Im using Wordpress to make a website. I already tried many plugins, but I didnt find any good plugin for this.

This is what I have At the moment. This is what I have At the moment.

But I want to do a list of spas, a picture and next to picture is text about this spa, and maybe is possible to make a button there (more informatsion) or something like this.

What I looking for.(I want something like this)

I want something like this

Can somebody help me? Thanks !



via Chebli Mohamed

Wordpress admin not working on plugin override

I have installed the plugin All in one security & firewall after changing the security settings i changed the login slug "http://ift.tt/XKSBaY" to "www.site.com/changed". But now when i am trying to access the site it is showing me internal server error. I deleted the plugin from plugin directory, removed all the plugin tables, & restore htaccess file, but on reinstalling, it is applying the same settings as before & showing internal server error on accessing the admin. I can't even login with the previous wp-admin slug on activating the plugin, not sure which database table plugin has updated.

I really want to use that plugin.

The plugin changed the htaccess file with #begin & #end, i removed that code. but still it is applying the previous settings on fresh installation.



via Chebli Mohamed

jeudi 25 février 2016

Longitude and latitude google maps plugin form wordpress

I'm looking for a way in WordPress to create a form exactly like this one : http://ift.tt/1oLJrsO

I tought that a plugin for this would be easy to find but it's not..

Anyone knows how to do this?

Thanks in advance for your help!



via Chebli Mohamed

Wordpress plugin modification alerts

I am using Wordpress and have Wordfence (free) watching over my site to make sure people aren't doing anything they shouldn't be doing. I recently got an email from Wordfence warning me about modified plugin files and I'm wondering if this is something I should be worried about? I don't think I've ever received an email before just doing my normal plugin updates. Would updates have triggered this? Or is it more?

Wordpress versions and such:

-WordPress 4.4.2
-Headway Theme v. 3.8.8
-Wordfence (free) v. 6.0.24
-Google Captcha (reCAPTCHA) by BestWebSoft v. 1.22 (this is on the login page, so it should help block automated attacks...)
-My username is not a generic 'admin' or anything like that, and I have WordFence set to immediately lock out any invalid username login attempts.
-and my password is decently strong.
-I do have other various plugins that are up to date, I just mention the above because they are supposed to help with security.

The Message I received was:

Alert generated at Thursday 25th of February 2016 at 11:41:32 PM

Warnings:

* Modified plugin file: wp-content/plugins/google-captcha/bws_menu/bws_functions.php

* Modified plugin file: wp-content/plugins/google-captcha/bws_menu/bws_menu.php

* Modified plugin file: wp-content/plugins/google-captcha/bws_menu/css/general_style.css

* Modified plugin file: wp-content/plugins/google-captcha/css/gglcptch.css

* Modified plugin file: wp-content/plugins/google-captcha/google-captcha.php

* Modified plugin file: wp-content/plugins/google-captcha/js/script.js

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-ar.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-ar.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-bg_BG.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-bg_BG.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-de_DE.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-de_DE.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-el.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-el.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-es_ES.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-es_ES.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-fa_IR.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-fa_IR.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-fr_FR.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-fr_FR.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-hi.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-hi.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-it_IT.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-it_IT.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-pl_PL.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-pl_PL.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-pt_BR.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-pt_BR.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-ru_RU.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-ru_RU.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-uk.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-uk.po

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-zh_TW.mo

* Modified plugin file: wp-content/plugins/google-captcha/languages/google-captcha-zh_TW.po

* Modified plugin file: wp-content/plugins/google-captcha/readme.txt

* Modified plugin file: wp-content/plugins/google-captcha/screenshot-5.png

* Modified plugin file: wp-content/plugins/google-captcha/screenshot-6.png

* Modified plugin file: wp-content/plugins/google-captcha/screenshot-7.png

* Modified plugin file: wp-content/plugins/google-captcha/screenshot-8.png

* Modified plugin file: wp-content/plugins/jetpack/_inc/jetpack-jitm.js

* Modified plugin file: wp-content/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-landing-page.php

* Modified plugin file: wp-content/plugins/jetpack/_inc/lib/markdown/gfm.php

* Modified plugin file: wp-content/plugins/jetpack/class.jetpack-modules-list-table.php

* Modified plugin file: wp-content/plugins/jetpack/class.jetpack-network.php

* Modified plugin file: wp-content/plugins/jetpack/class.jetpack.php

* Modified plugin file: wp-content/plugins/jetpack/class.json-api-endpoints.php

* Modified plugin file: wp-content/plugins/jetpack/class.json-api.php

* Modified plugin file: wp-content/plugins/jetpack/class.photon.php

* Modified plugin file: wp-content/plugins/jetpack/css/jetpack-admin.css.map

* Modified plugin file: wp-content/plugins/jetpack/functions.opengraph.php

* Modified plugin file: wp-content/plugins/jetpack/functions.photon.php

* Modified plugin file: wp-content/plugins/jetpack/jetpack.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-delete-media-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-delete-media-v1-1-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-post-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-post-v1-1-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-sharing-buttons-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php

* Modified plugin file: wp-content/plugins/jetpack/json-endpoints.php

* Modified plugin file: wp-content/plugins/jetpack/locales.php

* Modified plugin file: wp-content/plugins/jetpack/modules/contact-form/grunion-contact-form.php

* Modified plugin file: wp-content/plugins/jetpack/modules/custom-post-types/comics.php

* Modified plugin file: wp-content/plugins/jetpack/modules/custom-post-types/js/many-items.js

* Modified plugin file: wp-content/plugins/jetpack/modules/custom-post-types/portfolios.php

* Modified plugin file: wp-content/plugins/jetpack/modules/custom-post-types/testimonial.php

* Modified plugin file: wp-content/plugins/jetpack/modules/latex.php

* Modified plugin file: wp-content/plugins/jetpack/modules/minileven.php

* Modified plugin file: wp-content/plugins/jetpack/modules/module-headings.php

* Modified plugin file: wp-content/plugins/jetpack/modules/module-info.php

* Modified plugin file: wp-content/plugins/jetpack/modules/publicize/ui.php

* Modified plugin file: wp-content/plugins/jetpack/modules/related-posts/jetpack-related-posts.php

* Modified plugin file: wp-content/plugins/jetpack/modules/related-posts/related-posts.js

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/archives.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/flickr.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/instagram.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/presentations.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/scribd.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/slideshare.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/soundcloud.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/ted.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/twitter-timeline.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/vimeo.php

* Modified plugin file: wp-content/plugins/jetpack/modules/shortcodes/wufoo.php

* Modified plugin file: wp-content/plugins/jetpack/modules/stats.php

* Modified plugin file: wp-content/plugins/jetpack/modules/theme-tools/random-redirect.php

* Modified plugin file: wp-content/plugins/jetpack/modules/theme-tools/site-logo/js/site-logo-control.js

* Modified plugin file: wp-content/plugins/jetpack/modules/videopress/videopress.php

* Modified plugin file: wp-content/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js

* Modified plugin file: wp-content/plugins/jetpack/modules/widget-visibility/widget-conditions.php

* Modified plugin file: wp-content/plugins/jetpack/modules/widgets/contact-info.php

* Modified plugin file: wp-content/plugins/jetpack/modules/widgets/top-posts.php

* Modified plugin file: wp-content/plugins/jetpack/modules/widgets/wordpress-post-widget.php

* Modified plugin file: wp-content/plugins/jetpack/readme.txt

* Modified plugin file: wp-content/plugins/jetpack/views/admin/my-jetpack-page.php

* Modified plugin file: wp-content/plugins/youtube-channel/readme.txt

Is there anywhere I can check to see what or why they were modified? Or what IP made the changes or anything like that? I am the only one with access to the site, as in I don't have any friends or family members or co-workers that can also make changes.



via Chebli Mohamed

Adding a left and right sidebar to the Woocommerce Product Category Page

Currently I am trying to add a left side bar as well to Woocommerce's default product category page. Currently this is what I have:

Product Category

What I am trying to do is have it look like my custom page:

Custom Page

Is there a way I can change this in the backend? I have looked inside the woocommerce.php file but am unaware of how to add another bar. Below is what I see they are adding,

    get_header(); ?>

    <div id="primary" class="<?php echo esc_attr( $myth_primary_layout_classes ); ?>">
        <main id="main" class="site-main" role="main">

            <?php woocommerce_content(); ?>

        </main><!-- #main -->
    </div><!-- #primary -->

<?php include ( get_template_directory() . "/sidebar.php"); ?>
<?php include ( get_template_directory() . "/footer.php"); ?>



via Chebli Mohamed

Wordpress. Remove automatic redirect

I use plugin Types Toolset (wp-types.com). I created a type "technic". Then I added some records: "tractor", "agrimotor", etc. So link for "tractor" look like:

my_site.com/**technic**/tractor

Now I have a problem. I need to go to the link like:

my_site.com/**not_technic**/tractor

But I can't do it. When I try to go that link, I find myself on the:
my_site.com/**technic**/tractor AGAIN.
This is redirect. I dont want it. I need to see "404 Error" OR redirect to another link, NOT my_site.com/technic/tractor. So I need remove that automatic redirect. How can I do it? I have no any idea. Please help.



via Chebli Mohamed

HI all , I need WP plugin for sending email from [on hold]

I need WP plugin for sending email from WP to the user email address with fields screenshot



via Chebli Mohamed

How to fix Parse error: syntax error, unexpected T_PUBLIC for wordpress plugin

I have got an error message for custom payment wordpress plugin when processing the payment such as:

Parse error: syntax error, unexpected T_PUBLIC in /home/galer258/public_html/dev/wp-content/plugins/bcasakuku/result.php on line 3

or please check out this link for further info.

Here result.php script

<?php

public function doPayment(){

    $_POST = json_decode(file_get_contents("php://input"), 1);
    if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
        if( isset( $_POST['MerchantID'] ) AND isset( $_POST['TransactionID'] ) AND isset( $_POST['TransactionReffID'] ) AND isset( $_POST['Signature'] ) ){

            //VALIDATE MERCHANT ID
            if( $_POST['MerchantID'] ==  $_POST['MerchantID'] ){

                $orders = $_POST['TransactionID'];
                if( $orders AND is_numeric( $_POST['TransactionID'] ) ){

                    if( $orders['order_status_id'] == $this->$_POST['TransactionID'] {

                        $sakukuOrder = $_POST['TransactionID'];
                        if( $sakukuOrder ){
                            $str =  $sakukuOrder['AccToken'].$sakukuOrder['TransactionID'].$sakukuOrder['Amount'].$sakukuOrder['PaymentID'];
                            $validate = strtoupper( hash('sha256', $str) );

                            if( $_POST['Signature'] == $validate ){
                                $this->$sakukuOrder['TransactionID'], 5;
                                $this->generateOutput( 0, "00" );
                            }else{
                                $this->generateOutput( 1, "01" );
                            }

                        }else{
                            $this->generateOutput( 1, "01" );
                        }
                    }else{
                        $this->generateOutput( 2, "01" );
                    }           

                }else{
                    $this->generateOutput( 1, "01" );
                }
            }else{
                $this->generateOutput( 1, "01" );
            }

        }else{
            $this->generateOutput( 1, "01" );
        }
    }else{
        $this->generateOutput( 1, "01" );
    }
}

private function generateOutput( $rs, $status ){

    $reason = array(
        "Indonesian" => array("Sukses","Transaksi tidak dapat diproses.","Transaksi sudah dibayar."),
        "English" => array("Success","Transaction cannot be processed.","Transaction has been paid."),
    );

    $output = array(
            "MerchantID" => ( !isset( $_POST['MerchantID'] ) ) ? '' : $_POST['MerchantID'],
            "TransactionID" => ( !isset( $_POST['TransactionID'] ) ) ? '' : $_POST['TransactionID'],
            "FlagStatus" => "01",
            "ReasonStatus" => array( "Indonesian" => "", "English" => "" )
        );

    $output['FlagStatus'] = $status;
    $output['ReasonStatus']['Indonesian'] = $reason['Indonesian'][ $rs ];
    $output['ReasonStatus']['English'] = $reason['English'][ $rs ];
    echo json_encode($output);      
}
?>

You can try to buy one product on this link using BCA sakuku as payment option like screenshot below:

BCA SAkuku Payment Option

Any help would be much appreciated.



via Chebli Mohamed

order remains pending and stock not minus after order place by paypal in Woocomerce v-2.5.2 in wordpress

I have test using sendbox test account payment get successful message and payment also transfer from account but order remains in pending. Thanks in advance.



via Chebli Mohamed

Woocommerce Limit specific product sales to one per shipping adress

If got a strange question about woocommerce and im aware that there will still be a lot of ways to get around this, but my question is as follow.

My client asked me to make a simple woocommerce website. It looked simple but there are some complications now. There is only one product sold on this website.

But here's the catch. This company also wants visitors to be able to order a sample product. This is in fact the same product as the normal one, but its a bit cheaper and and you ca only order 1 item.

So what the clients wants is a check on shipping address when someone is ordering a sample. So i need to somehow check the shipping address with the database to see if there is already an order for this specific product with this specific address. If false, the order can be continued, if true, the order can not be placed and the user is presented a message.

I know people can easily change addresses to keep buying samples, but this was what the client asked. Im really thinking of a different approach but the problem is that users don't have to make an account so im really not sure what would be the best way to prevent multiple sample orders by one person.

Hope someone has a fresh mind and could put me in the right direction. Other ideas are welcome as wel, but im not able to think of a good way anymore;)



via Chebli Mohamed

How to Pause the timer on window blur and resume the timer on window focus event?

Thanks for seeing my question. I am using wp-pro-quiz plugin for quiz. I want to know that how can I pause the timer if the window is not in focus or is blur and resume it when it is back to focus.? My code:

 var timelimit = (function() {
        var _counter = config.timelimit;
        var _intervalId = 0;
        var instance = {};

        instance.stop = function() {
            if(_counter) {
                window.clearInterval(_intervalId);
                globalElements.timelimit.hide();
            }
        };

        instance.start = function() {
        var x;
            if(!_counter)
                return;
        var $timeText = globalElements.timelimit.find('span').text(plugin.methode.parseTime(_counter));
            var $timeDiv = globalElements.timelimit.find('.wpProQuiz_progress');

            globalElements.timelimit.show();
            $.winFocus(function(event) {
               console.log("Blur\t\t", event);
           },
           function(event) {
             console.log("Focus\t\t", event);
          x = _counter * 1000;
            });



            var beforeTime = +new  Date();

            _intervalId = window.setInterval(function() {

                var diff = (+new Date() - beforeTime);
                var elapsedTime = x - diff;

                if(diff >= 500) {
                    $timeText.text(plugin.methode.parseTime(Math.ceil(elapsedTime / 1000)));
                }

                $timeDiv.css('width', (elapsedTime / x * 100) + '%');

                if(elapsedTime <= 0) {
                    instance.stop();
                    plugin.methode.finishQuiz(true);
                }

            }, 16);
        };

        return instance;

    })();



via Chebli Mohamed

mercredi 24 février 2016

Contact Form 7 - function/hook to change style of response output?

I'm using Contact Form 7 with WordPress - And up until this point, i've achieved my styling by using HTML tags within Contact Form 7's 'Message' area.

A recent update has removed this ability, and thus strips all HTML from these fields before submission.

As i have a number of sites which follow the same responsive styling, Ideally - all i need to be able to do is wrap the content inside wpcf7-response-output, with another div ideally.

I was just wondering if there's any particular hook/action we can use to alter this styling?

Thanks!



via Chebli Mohamed

WooCommerce showing subcategories and products together

I'm using WooCommerce plugin in my Wordpress site.

I've made some categories and I'm showing them in a wordpress page with the following snippet:

[product_categories parent="0" orderby="name" order="ASC" hide_empty="1" ids="1,2,3"]

Under the first category, I've also made 3 subcategories that I'll call 1A, 1B, 1C to be more clear.

I've a lot of products of the "id=1 kind" and some of them belong to one of those subcategories and some other products belong to the parent category (id=1).

I'd like that when the user opens the categories page and clicks to the (id=1) category he can see, in addition to the three subcategories, also the products that belongs to id=1.

Actually, it is showing only the three subcategories and zero products of the parent category; I'd like to see together the subcategories and the products belonging to id=1, is it possibile?

thanks in advance for your help :)



via Chebli Mohamed

TypeError: $(...).foundation, superfish and nivoSlider are not functions

I have 3 JavaScript errors on my wordpress site:

TypeError: $(...).foundation is not a function;
TypeError: $(...).SuperFish is not a function;
TypeError: $(...).nivoSlider is not a function

I read that it might be because the site is loading multiple jQuery libraries. It could be a noConflict issue or maybe that the function isn't being defined in the header. Unfortunately, I'm not savvy enough code-wise to adopt other people's solutions to my problem. I would really appreciate it if someone could look directly at my problem, and provide insight.

Here's a link to my site.

enter image description here



via Chebli Mohamed

WordPress Shopping Cart - Traditional Gift cards

My client is a restaurant and the only product they sell online is a traditional giftcard. The orders are manually fulfilled by the admin staff at the restaurant and a real, plastic giftcard is mailed to the recipient.

My store needs to allow selection of the single product, selection of $ amount, selection of quantity. Also needs a "FROM", "TO", "MESSAGE", "Shipping Info"

I've evaluated WPEasyCart and WooCommerce, but neither are configurable to this degree. Any suggestions on other plugins that can handle this scenario?

Thanks



via Chebli Mohamed

how to get data from input field in wordpress to retrieve data from database against user input

In word press plugin i tried to read user input from text field to fetch data from database against user input (text field). I tried to do it by Ajax technique but not successful yet. i google it and found some techniques which are given on following links

http://ift.tt/1AuZsTC

http://ift.tt/1EMcdfe

i develop plugin and write query to fetch data for specific input but now i'm confuse how to read and pass it to ajax and then display. actually i can do this in PHP and ajax techniques but that is not smart solution, i suppose if word press has some nice and smart solution to read input and then call some function to get that data.

other way i have is simply put button when user will press button then trigger java script function containing ajax code to bring required data.

can you share some food example.



via Chebli Mohamed

Woocommerce simple product attribute

Hi everyone I want to ask if someone know how to make the attribute from text to be shown as simple product.

For example if I have a t-shirt in a simple product and I put some attributes like size: M,L,S and by default they are shown as text and you can not select any of them and not as radio buttons or as drop down list is it possible to make them show as drop down list or radio buttons without making the product as Variable product?



via Chebli Mohamed

Mailchimp api custom form

I have thrive leads plugin in my wordpress... I want to build custom form with mailchimp api but when I go on option API for connection it only offers three options I can't change(Phone number, email and name) but I need(website, email and name) how to change this



via Chebli Mohamed

mardi 23 février 2016

How to create 'import dummy data' option in custom wordpress plugin

I am creating a custom plugin in WordPress in which i want to add import dummy content option but didn't found anything yet can anyone please tell me the procedure to create the import dummy content option



via Chebli Mohamed

How to check preconditions before login wordpress

Greetings

I want to check user status before login. e.g if user role is tester don't login. else login.

Thanks



via Chebli Mohamed

How to add multiple images in _product_image_gallary using php

I need to copy images from a remote server and add multiple values to _product_gallary_image post meta in wordpress. For example it should be like that;

_product_image_gallary | 123,456,124,786,653

Everything is working fine except all image ids are not added only last image is added. When i use add_post_meta in foreach loop its adding all images in seperate row like; 205 _product_image_gallary 234 205 _product_image_gallary 235 205 _product_image_gallary 236

Please check code here http://ift.tt/1VDdHA9.



via Chebli Mohamed

I'd like to send different response emails from Contact Form 7 depending on user input

I'm setting up a wedding website with an RSVP form. On the form I have a drop down menu with "I am attending" and "I am not attending".

I'd like to be able to send different emails to these people based on their responses.

I can't find anything about including conditional login inside the auto-responder part of the plug-in.

Thanks for your help.



via Chebli Mohamed

Wordpress site crashing whole server without error message

A wordpress site was working properly, suddenly, it stopped working, properly something was done unintentionally.

Wordpress version is 4.4.2 running on Ubuntu 14.04

The site does not load, and then all the other sites on the server stop loading!

I got an error in apache error.log

[mpm_prefork:error] [pid 1047] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

It seems that the theme or one of the plugins is causing issues We hav

It seems that one of the plugins is causing



via Chebli Mohamed

Adding html in wordpress plugin

I am writing my first wordpress plugin. It's supposed to send a message on plugin page whenever user saves/edits pages. The problem is I can't quite get it to print the messages.

Here is my code:

<?php

    /*
    Plugin Name: Monitor
    Plugin URI:
    Description: Test plugin monitoring user activities
    Author: 
    Version: 1.0
    Author URI: 
    */


if (!function_exists('p_update')) {  
    function p_update( $post_id ) {
        $post_title = get_the_title( $post_id );
        $post_url = get_permalink( $post_id );
        $message = "Changed: " . $post_title . "Link: " . $post_url ;
        echo "<p>test1</p>"
    }
}

if (!function_exists('p_publish')) {
    function p_publish( $post_id ){
        $post_title = get_the_title( $post_id );
        $post_url = get_permalink( $post_id );
        $message = "abc";
        echo "<p>test2</p>"
    }
}

if (!function_exists('plugin_menu')) {
    function plugin_menu() {
        add_menu_page( 'Monitor', 'Monitor', 'manage_options', __FILE__, 'plugin_options');
    }
}

if (!function_exists('plugin_options')) {
    function plugin_options() {
        if ( !current_user_can( 'manage_options' ) )  {
            wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
        }
    echo '<div class="wrap">';
    echo '<p>test</p>';
    echo '</div>';
    }
}

add_action( 'admin_menu', 'plugin_menu' );
add_action('save_post', p_update);
add_action('publish_post', p_publish);

?>

The plugin_menu function displays html properly, but other functions can't do that. What am I doing wrong? I'm sure there is some easy way of doing that but no tutorial I've seen adresses this problem.

Thank you in advance for your help.



via Chebli Mohamed

Woocommerce Abandoned Cart Lite Plugin not sending emails

I have the Woocommerce Abandoned Cart Lite plugin installed. I have also turned off the standard WP_Cron and set up a manual cron instead. This is set up on a digital ocean LAMP stack.

I have a crontab set up with this in

* * * * * curl http://ift.tt/1Q9e4yC > /dev/null 2>&1

and was pretty sure this was working because I set up a temporaty schedule to send myself an email every minute which was working.

So in the abandoned cart lite plugin, I can set up the email template, and can see the carts being abandoned, I have set the email to go out 1 hour after cart abandoned, but I never get the email. I have tested the email template, which does work.

Is my cron right, or does the lite version of the plugin even send automated emails?



via Chebli Mohamed

Page redirect after successful submit form is not working in contact form 7 wordpress

Page redirect after successful submit form is not working in contact form 7 wordpress.When I add page in redirect plugin the captcha code error is occured and page is not submitted to the page that i want to send.



via Chebli Mohamed

Wordpress add_filter after post

I'm trying to add custom plugin after single post content. I have tried with add_filter and add_action to get my plugin printed out.

     if(!defined('ABSPATH')) exit;

 function customPlug_plugin_install()
 {

 }

 register_activation_hook(__FILE__, 'customPlug_plugin_install');

 function customPlug_plugin_scripts()
 {
    wp_register_script('customPlug_script', plugin_dir_url(__FILE__), 'js/customplug.js', '1.0', true);
    wp_register_script('customPlug_bootstrap_script', plugin_dir_url(__FILE__), 'js/customplug.js', '1.0', true);
    wp_register_script('customPlug_script', plugin_dir_url(__FILE__), 'js/customplug.js', '1.0', true);
    wp_enqueue_script('customPlug_script');
 }


 function my_plugin($content) {
    $content = "Custom Plugin Content";
    return $content;
 }
 add_action('the_content', 'my_plugin');

However, this is just returning either the plugin content, or the_content if I comment out add_filter or add_action



via Chebli Mohamed

is there a wordpress plugin to save credit cards on file

Getting ready to build a coupon or daily deals site. My client wants the ability to save credit cards on file so the buyer can come back and use his/hers credit card on file. Anyone know of a plugin that will do this?



via Chebli Mohamed

WordPress Plugin export front end

I'm looking for a WordPress plugin that allows to export in a generic format(csv, xls, etc.) the posts belonging to a particular category . A fundamental requirement is the ability to make the export directly from the frontend. I tried dozens of plugins but no one seems to do what I need.

Thanks and sorry for my bad english.

Luigi

P.S. My interest is mainly in exporting post titles and dates. The actual content is not essential



via Chebli Mohamed

WordPress Magento plugin

I have a problem with Magento plugin on WordPress.
The plugin is installed and configured. Magento SOAP API is set for a user with Role.
Now, in my post, nothing happens. It shows empty DIV, while i have products and categories to show. Any ideas?

Note: I made a code debug for the plugin's connection, seems that everything is ok. But i get empty response. The content is empty all the time.



via Chebli Mohamed

lundi 22 février 2016

Custom Wordpress function takes up all CPU, even after deleted

I had built a custom Wordpress plugin to download an image from a remote server and attach it to a post on save_post

The function is using download_url and media_handle_sideload

Everything works fine when saved from the Edit page, but when you save the post from Quick Edit button, that post gets permanently messed up and won't load at all, or will partially. I fixed this by checking for the global $post variable which doesn't exist with Quick Edit.

Regardless, the pages that were "quick saved" are still messed up even with the plugin gone from the server.

I just checked the server processes with top and found the following when the edit.php page on the aforementioned posts is opened

11022 www-data 20 0 532796 100584 24488 R 99.3 9.9 0:13.31 php5-fpm

I have no idea how this is happening or why since the script that caused the problem is gone

Here is the plugin code:

function attach_images() {
    global $post;
    $post_id = $post->ID;
    if(!$post_id) {return;}
    $post_type = get_post_type( $post_id );
    $allow_types = array( 'resident', 'event' );
    if( !in_array( $post_type, $allow_types ) ) {
        return;
    }

    remove_action( 'save_post', 'attach_images' );

    for ($i = 0; $i <= 10; $i++) {

        //Check if title in this row already exists, skip if it does
        $gallery_check = get_field( 'gallery', $post_id )[$i]['image'];
        if( is_array( $gallery_check ) ) {
            return;
        }
        //get temp migration values
        $attachment_url = get_field('attachment_' . $i . '_url', $post_id);
        $attachment_title = get_field('attachment_' . $i . '_title', $post_id);
        $attachment_caption = get_field('attachment_' . $i . '_caption', $post_id);

        //download image file
        $tmp = download_url( $attachment_url );
        $file_array = array(
            'name' => basename( $attachment_url ),
            'tmp_name' => $tmp
        );

        // Check for download errors
        if ( is_wp_error( $tmp ) ) {
            @unlink( $file_array[ 'tmp_name' ] );
            return $tmp;
        }

        $image_id = media_handle_sideload( $file_array, $post_id );
        // Check for handle sideload errors.
        if ( is_wp_error( $image_id ) ) {
            @unlink( $file_array['tmp_name'] );
            return $image_id;
        }
        $attachment_url = wp_get_attachment_url( $image_id );

        //if uploaded and url is good, add values to row
        if($attachment_url != undefined && $attachment_url != '') {
            $value[] = array(
                'image' => $image_id,
                'title' => $attachment_title,
                'caption' => $attachment_caption
            );
            update_field( 'gallery', $value, $post_id );
        }
    }

    add_action( 'save_post', 'attach_images' );
}

add_action( 'save_post', 'attach_images' );



via Chebli Mohamed

How do I get a Slack bot to import markdown?

Currently have a bot setup in Slack for a wordpress site(utilizing the slack plugin). Anytime someone makes a comment on the wordpress site the slack bot will post that comment in the channel specified. If someone comments on the wordpress site using markup, the bot will not transfer that markup, but instead push out the raw HTML.

Wordpress comment:

### Maintenance 

Desired Effect(and how it's coming out on wordpress):

Maintenance 2/22/2016

Slack bot's output:

<h3>Maintenance 2/22/2016</h3>

Has anyone found a workaround for this? Would be okay with integrating slack's markup into my comment fields(if that's possible) -- would like both the wordpress comment and slack comment be the same.

Let me know if I can clear up any confusion or elaborate on this issue.



via Chebli Mohamed

Simple add_shortcode code doesn't work

my wp plugin code:

<?php
/*
Plugin Name: ...
...
*/

class Pform {   
    function __construct() {
        add_shortcode('pform', array($this, 'show_form');
    }

    function show_form() {
        $html = <<<EOT
            <form id="pform" action="#">
            ...
            </form>
EOT;
        return $html;
    }   
}

function efinstall() {

    $tb_name = $wpdb->prefix . 'table';

    if($wpdb->get_var("show tables like '$tb_name'") != $tb_name) 
    {
       $sql = "CREATE TABLE " . $tb_name . " (
       id mediumint(9) NOT NULL AUTO_INCREMENT,
       ...
       UNIQUE KEY id (id)
       );";

       require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
       dbDelta($sql);
       $form = new Pform();     
   }    
}
register_activation_hook(__FILE__,'efinstall');
?>

After plugin activation db table is successfully created and no error is added to log, but [pform] shortcode doesn't work and there is no it in

<?php
global $shortcode_tags;
echo "<pre>"; print_r($shortcode_tags); echo "</pre>";
?>

output.

Any help would be appreciated!



via Chebli Mohamed

Wordpress error while commenting

I am getting below error while commenting below a post in wordpress.

Catchable fatal error: Object of class WP_Error could not be converted to string in /home/coderzhe/public_html/wp-includes/formatting.php on line 1025

Can anyone please help me to fix this. Thanks in advance.



via Chebli Mohamed

Wordpress plug-in - Tooltips not working

I'm a design intern at Brickbacker, and we have a problem with our website: http://brickbacker.com/

I'll try to make this short, but it isn't easy!

I've been given the task to fix a problem with tooltips not working correctly in a modal-pop-up, we made with the plug-in "Formcraft". It is activated when the button "Get started" is clicked.

When the tooltips are activated, they quickly appear at the wrong spot, and then become hidden.

We've tried to contact the developers of the plug-in as well as our theme, and they both say it might be a conflict with the theme or other plug-ins. We have tried to disable every plug-in one at a time while checking the tooltips - and it still doesn't work. We also tried to change the theme, but then the get-started button won't be shown.

I'm pretty sure it must be some kind of conflict between our theme Flatsome and Formcraft, but I absolutely can't tell whether it's in the CSS or somewhere else?

For some reason, whenever a tooltip is activated, the < div >-tag is still there. So if you hover over a tooltip 100 times, there will be 100 invisible < div >-tags. It's very strange.

So I was wondering if anyone is able to see what might be causing the problem, or have any tips as to how we can figure out where the conflict is?

Thank you very much!



via Chebli Mohamed

Foreach with multiples variable - showing URL

I hope someone can help me out on this one.

I want to print a url base on Home - Category - subcategory -post

Basicaly is a 4 deep silo architecture using pages for category and subcategory.

I succeed to get the first 2 working but cant find how to add the third variable working in that code.

Any help is welcome :)

There is what I get so far

$alink= get_category_link ($alink_cat_id );
$blink = get_the_permalink ($blink _id);
$clink = get_the_permalink ($clink_cat_id );

$request = $alink 
$destination = $blink
//This is the var I need to get into the result
//$seconddestination = $clink 

//Get entire array
$redirects = get_option('redirects');

//Alter the options array appropriately
$redirects[$request] = $destination;

//Update entire array
update_option('redirects', $redirects);


///Show the Full URL///

    echo '<br><h3>Show Full URL Silo Page</h3>';

$redirects = get_option('redirects');
            if (!empty($redirects)) {


                foreach ($redirects as $a => $b) {
                         echo $a.' &nbsp;&nbsp;    >>> &nbsp;&nbsp;    '.$b.'<br>';
                }
                }



via Chebli Mohamed

Change a time on wordpress site to time zone a static time

I have a wordpress website and it displays this on our contact page

"Our hours are 06:00-15:00 UTC/GMT"

I would like to display this time to the correct timezone when the user is viewing the webpage. for example from south africa

"Our hours are 08:00-17:00 UTC/GMT"

If possible can this be done with a plugin because I dont know php to go changing script or sql queries

Thank you any help welcome



via Chebli Mohamed

dimanche 21 février 2016

fusion core version 1.6.2 shortcode not working

I have wordpress Version 4.4.2 , avada Version: 3.7.4 and fusion core plugin version 1.6.2 . The shortcode is not working. The page is full blank and not displaying content. I tried reactivating all plugins but didn't work, then replacing class_blog.php file in fusion core plugin and it worked and got content but css all got changed. Please help me i am new to wordpress. Where to download class_blog.php of fusion core 1.6.2 version ? Or are there any other solutions.



via Chebli Mohamed

how to send an email according to the department wise

Good Morning guys, since am new to php, my management asked to do a task "when user send an information through the contact form it should be able to send an email according to the department wise, for example when user need to send an email to career department while they are selecting subject as career it should be delivered to career department. i have to do it on word press site with the help of php code, so can anyone please help me to solve this, awaiting for your valuable replies thank you.



via Chebli Mohamed

WooCommerce & Redux framework - submenu pages

Im doing a WooCommerce plugin and Im trying to do settings pages with Redux framework.

How do I place thpages under WooCommerce admin menu in certain place - like last place?

Moreover, how do I put those settings pages under a tab in WooCommerce settings page?

I managed to place my settings page as submenu item in WooCommerce side menu, but how do I set its order?



via Chebli Mohamed

Wordpress Page Builder is mixing up with theme - why?

I am new to Wordpress but not HTML and CSS. I installed a theme and then got the Page Builder Plugin.

When I use the page builder it seems to want to create a lovely crips full width site but it goes over the the top of some of the theme style/content.

It's mixed up.

How do I get page builder to be the only source for the overall design.

I considered using CSS to hide some elements of the theme and have managed to hide the side bar - is this the best practice?

Please see the linkhttp://ift.tt/1Q8ZTNz

If it is a case of just using CSS to hide certain elements then great! But I am thinking there is a simpler way as it is in Wordpress.



via Chebli Mohamed

samedi 20 février 2016

Add a button to reset WordPress theme options

I have created a theme options page for a WordPress theme, and I need to add a Reset button to clear all the user defined settings for theme options.

I'm told that this function will do the job,

function reset_mytheme_options() { 
    remove_theme_mods();
}
add_action( 'after_switch_theme', 'reset_mytheme_options' );

But, don't know how to run this function on a button click.

So, will this function do what I needed ? If so, how to run it on a button click ?



via Chebli Mohamed

How to show subcategory on checkout page and on email send to admin in Woocommerce plugin

i have a website which has woo-commerce plugin and i want to do like

Category - Vegetarian, Non Vegetarian, Drink etc

Under main category there are subcategory which are used as the restaurants.

Sub category as Restaurants name - Mcdonalds, dominos etc.

Now i want that subcategory name shown in checkout page,order view page as well as on email sent to admin so that admin can confirm that in which restaurant this order will go.



via Chebli Mohamed

Invalid shipping method error on checkout woocommerce

i am using WooCommerce in wordpress and when ever i try to checkout i got this error

Invalid shipping method.

checkout page working fine when i disabled shipping option in

WooCommerce > Settings > Shipping

i searched about this issue and WooCommerce geeks mostly says to Allowed All Countries in

WooCommerce > Settings > General

but it still not worked for me

is there any other possible problem ? how may i debug this problem

you may experience this problem here



via Chebli Mohamed

php file is not overriding in wordpress child theme

I have a coruscate premium theme. I have created a child theme for future protection. I want to override a function in file parent-theme/framework/shortcodes/widgets.php which is defined as:

function wt_shortcode_recent_posts($atts) {
  //some code here
}
add_shortcode('wt_recent_posts', 'wt_shortcode_recent_posts');

Now, In my functions.php of child theme, I tried to override the function as:

function wt_shortcode_recent_posts($atts) {
   //some modified code here
}

I have also tried making a file to identical directory as child-theme/framework/shortcodes/widgets.php. It also doesn't work.

What is the correct way to override those functions or php files in wordpress child theme.



via Chebli Mohamed

Load data.csv when installing plugin

I am new to wordpress plugin development. I want to create a new table when someone installs the plugin and populate the daata from csv file into the table.

Here is my code to create table:

$sql = "CREATE TABLE $table_name (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `location` varchar(150) NOT NULL,
    `slug` varchar(150) NOT NULL,
    `population` int(10) unsigned NOT NULL,
       PRIMARY KEY (id) 
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8";

$wpdb->query($sql);

After running this table is created.

Issue is that I am finding it difficult to populate data.csv into the table.

In windows xampp it is working

$current_plugin_dir = dirname(__FILE__);
$current_plugin_dir = str_replace("\\","\\\\",$current_plugin_dir);
$current_plugin_dir = $current_plugin_dir . '\\\\data.csv';
$sql = "LOAD DATA LOCAL INFILE '$current_plugin_dir' INTO TABLE $table_name";
$wpdb->query($sql);

While live server it is not working... But following code works...

$current_plugin_dir = $current_plugin_dir.'/data.csv';
$sql = "LOAD DATA LOCAL INFILE '$current_plugin_dir' INTO TABLE $table_name";
$wpdb->query($sql);

But in my ubuntu operating system no one seems to work.. I debugged and it seems following query ran on ubuntu lamp environment

LOAD DATA LOCAL INFILE '/var/www/html/testwp/wp-content/plugins/plugin-name/data.csv' INTO TABLE test_population

and it triggered following error

1148 - The used command is not allowed with this MySQL version

Is there any single way of loading csv on all platforms? Any help?



via Chebli Mohamed

Which is the best Directory theme available in the market? [on hold]

I have searched and found directory http://ift.tt/1KKX0l0 and listable http://ift.tt/1OimoPC.

Both are good but i want the best solution. can any one please help me to best a theme?



via Chebli Mohamed

Limited download on file per user plugins in Wordpress

I need a plugin which allows limited download on file per user (e.g. 1 user per 1 voucher). I have vouchers that can be use of one time only and i don't want user to download it multiple times. I saw a plugin called Group File Access but I need a free one. Thanks for your help.



via Chebli Mohamed

vendredi 19 février 2016

Display some product first in woocommerce.

created product_brand taxonomy for woocommerce . In this i have a brand called adc . So in that brand page i need to display some product first .For to customize adc brand page i crate taxonomy-product_brand-adc.php .But how to customize the loop ? . I know how to use post_in and order by variable .

Please help .



via Chebli Mohamed

How to fix GCM limit of 1000, need to send message to 15000 devices,

i have a script which is used to send GCM to android, but unfortunately it stops working after 1000 messages, can anyone fix this code so that it can work after 1000 users also, the error i receive is "Number of messages on bulk (1412) exceeds maximum allowed (1000)" here is the php code below:

<?php

$gcm_result = "should be empty";

$version = get_bloginfo('version');
if ($version < 3.8) {
function px_gcm_menu() {
    add_menu_page('GCM', 'GCM', 'manage_options', 'px-gcm','');
    add_submenu_page( 'px-gcm', __('New Message','px_gcm'), __('New Message','px_gcm'), 'manage_options', 'px-gcm', 'px_display_page_msg');
    add_submenu_page( 'px-gcm', __('All Devices','px_gxm'), __('All Devices','px_gxm'), 'manage_options', 'px-gcm-devices', 'px_display_devices');
    add_submenu_page( 'px-gcm', __('Stats','px_gxm'), __('Stats','px_gxm'), 'manage_options', 'px-gcm-stats', 'px_display_stats');
    add_submenu_page( 'px-gcm', __('Export','px_gxm'), __('Export','px_gxm'), 'manage_options', 'px-gcm-export', 'px_display_export');
    add_submenu_page( 'px-gcm', __('Settings','px_gcm'), __('Settings','px_gcm'), 'manage_options', 'px-gcm-settings', 'px_display_page_setting');
}
add_action('admin_menu', 'px_gcm_menu');
}else { 
function px_gcm_menu() {
    add_menu_page('GCM', 'GCM', 'manage_options', 'px-gcm','','dashicons-cloud');
    add_submenu_page( 'px-gcm', __('New Message','px_gcm'), __('New Message','px_gcm'), 'manage_options', 'px-gcm', 'px_display_page_msg');
    add_submenu_page( 'px-gcm', __('All Devices','px_gxm'), __('All Devices','px_gxm'), 'manage_options', 'px-gcm-devices', 'px_display_devices');
    add_submenu_page( 'px-gcm', __('Stats','px_gxm'), __('Stats','px_gxm'), 'manage_options', 'px-gcm-stats', 'px_display_stats');
    add_submenu_page( 'px-gcm', __('Export','px_gxm'), __('Export','px_gxm'), 'manage_options', 'px-gcm-export', 'px_display_export');
    add_submenu_page( 'px-gcm', __('Settings','px_gcm'), __('Settings','px_gcm'), 'manage_options', 'px-gcm-settings', 'px_display_page_setting');  
}
add_action('admin_menu', 'px_gcm_menu');
}

/*
*
* All the functions for the settings page
*
*/
function px_register_settings() {
add_settings_section('gcm_setting-section', '', 'gcm_section_callback', 'px-gcm');
add_settings_field('api-key', __('Api Key','px_gcm'), 'api_key_callback', 'px-gcm', 'gcm_setting-section');
add_settings_field('snpi', __('New post info','px_gcm'), 'snpi_callback', 'px-gcm', 'gcm_setting-section');
add_settings_field('supi', __('Updated post info','px_gcm'), 'supi_callback', 'px-gcm', 'gcm_setting-section');
add_settings_field('abd', __('Display admin bar link','px_gcm'), 'abd_callback', 'px-gcm', 'gcm_setting-section' );
add_settings_field('debug', __('Show debug response','px_gcm'), 'debug_callback', 'px-gcm', 'gcm_setting-section' );
register_setting( 'px-gcm-settings-group', 'gcm_setting', 'px_gcm_settings_validate' );
}

 // load the translations
 function px_gcm_load_textdomain() {
  load_plugin_textdomain( 'px_gcm', false, basename( dirname( __FILE__ ) ) . '/lang' ); 
}

function gcm_section_callback() {
echo __('Required settings for the plugin and the App.','px_gcm');
}

function api_key_callback() {
$options = get_option('gcm_setting');
?>
<input type="text" name="gcm_setting[api-key]" size="41" value="<?php echo $options['api-key']; ?>" />
<?php
}

function snpi_callback(){
$options = get_option('gcm_setting');
$html = '<input type="checkbox" id="snpi" name="gcm_setting[snpi]" value="1"' . checked(1, $options['snpi'], false) . '/>';
echo $html;
}

function supi_callback(){
$options = get_option('gcm_setting');
$html= '<input type="checkbox" id="supi" name="gcm_setting[supi]" value="1"' . checked(1, $options['supi'], false) . '/>';
echo $html;
}

function abd_callback() {
$options = get_option('gcm_setting');
$html = '<input type="checkbox" id="abd" name="gcm_setting[abd]" value="1"' . checked(1, $options['abd'], false) . '/>';
echo $html;
}

function debug_callback() {
$options = get_option('gcm_setting');
$html = '<input type="checkbox" id="debug" name="gcm_setting[debug]" value="1"' . checked(1, $options['debug'], false) . '/>';
echo $html;
}

function px_gcm_settings_validate($arr_input) {
$options = get_option('gcm_setting');

if(isset($arr_input['api-key'])) {
    $options['api-key'] = trim($arr_input['api-key']);
}
if(isset($arr_input['snpi'])) {
    $options['snpi'] = trim($arr_input['snpi']);
}
if(isset($arr_input['supi'])) {
    $options['supi'] = trim($arr_input['supi']);
}
if(isset($arr_input['abd'])) {
    $options['abd'] = trim($arr_input['abd']);
}
if(isset($arr_input['debug'])) {
    $options['debug'] = trim($arr_input['debug']);
}

return $options;
}

/*
*
* Send notification for post update
*
*/
function px_update_notification($new_status, $old_status, $post) {
$options = get_option('gcm_setting');
if($options['snpi'] != false){
    if ($old_status == 'publish' && $new_status == 'publish' && 'post' == get_post_type($post)) {
        $post_title = get_the_title($post);
        $post_url = get_permalink($post);      
        $post_id = get_the_ID($post);
        $post_author = get_the_author_meta('display_name', $post->post_author);
        $message = $post_title . ";" . $post_url . ";". $post_id . ";" . $post_author . ";";

        // Send notification
        $up = "update";
        px_sendGCM($message, $up, 010);
    }
    }
    }

/*
*
* Send notification for new post
*
*/
function px_new_notification($new_status, $old_status, $post) {
$options = get_option('gcm_setting');
if($options['snpi'] != false){
    if ($old_status != 'publish' && $new_status == 'publish' && 'post' == get_post_type($post)) {
        $post_title = get_the_title($post);
        $post_url = get_permalink($post);
        $post_id = get_the_ID($post);
        $post_author = get_the_author_meta('display_name', $post->post_author);
        $message = $post_title . ";" . $post_url . ";". $post_id . ";" . $post_author . ";";

        // Send notification
        $np = "new_post";
        px_sendGCM($message, $np, 010);
    }
}
}

/*
*
* Register ToolBar
*
*/
function px_gcm_toolbar() {
$options = get_option('gcm_setting');
if($options['abd'] != false){
    global $wp_admin_bar;
    $page = get_site_url().'/wp-admin/admin.php?page=px-gcm';
    $args = array(
        'id'     => 'px_gcm',
        'title'  => '<img class="dashicons dashicons-cloud">GCM</img>', 'px_gcm',
        'href'   =>  "$page" );

    $wp_admin_bar->add_menu($args);
}
}

/*
*
* GCM Send Notification
*
*/
function px_sendGCM($message, $type, $regid) {
global $wpdb;
$px_table_name = $wpdb->prefix.'gcm_users';
$options = get_option('gcm_setting');
$apiKey = $options['api-key'];
$url = 'http://ift.tt/YbbTRA';
$result;
$id;

if($regid == 010) {
    $id = px_getIds();
}else {
    $id = $regid;
}

if($id == 010 && $id >= 1000){
    $newId = array_chunk($id, 1000);
    foreach ($newId as $inner_id) {
        $fields = array(
            'registration_ids' => $inner_id,
            'data' => array($type => $message) 
        );

        $headers = array(
            'Authorization' => 'key=' . $apiKey,
            'Content-Type' => 'application/json'
        );

        $result = wp_remote_post($url, array(
            'method' => 'POST',
            'headers' => $headers,
            'httpversion' => '1.0',
            'sslverify' => false,
            'body' => json_encode($fields) )
        );
    }
}else {
    $fields = array(
        'registration_ids' => $id,
        'data' => array($type => $message)
    );

    $headers = array(
        'Authorization' => 'key=' . $apiKey,
        'Content-Type' => 'application/json'
    );

    $result = wp_remote_post($url, array(
        'method' => 'POST',
        'headers' => $headers,
        'httpversion' => '1.0',
        'sslverify' => false,
        'body' => json_encode($fields))
    );

}

$msg = $result['body'];
$answer = json_decode($msg);
$cano = px_canonical($answer);
$suc = $answer->{'success'};
$fail = $answer->{'failure'};
$options = get_option('gcm_setting');
if($options['debug'] != false){
    $inf= "<div id='message' class='updated'><p><b>".__('Message sent.','px_gcm')."</b><i>&nbsp;&nbsp;($message)</i></p><p>$msg</p></div>";
}else {
    $inf= "<div id='message' class='updated'><p><b>".__('Message sent.','px_gcm')."</b><i>&nbsp;&nbsp;($message)</i></p><p>".__('success:','px_gcm')." $suc  &nbsp;&nbsp;".__('fail:','px_gcm')." $fail </p></div>";
}

// Updating stats
$suc_num = get_option('px_gcm_suc_msg', 0);
update_option('px_gcm_suc_msg', $suc_num+$suc);
$fail_num = get_option('px_gcm_fail_msg', 0);
update_option('px_gcm_fail_msg', $fail_num+$fail);
$total_msg = get_option('px_gcm_total_msg', 0);
update_option('px_gcm_total_msg', $total_msg+1);
for($i=0; $i < count($id); $i++) {
    $temp = $id[$i];
    $send_msg = $wpdb->get_row("SELECT send_msg FROM $px_table_name WHERE gcm_regid='$temp' ");
    $new_num = $send_msg->send_msg+1;
    $upquery = "UPDATE $px_table_name SET send_msg=$new_num WHERE gcm_regid='$temp' ";
    $wpdb->query($upquery);
}

global $gcm_result;
$gcm_result = $inf;
return $inf;
}

function px_getIds() {
global $wpdb;
$px_table_name = $wpdb->prefix.'gcm_users';
$devices = array();
$sql = "SELECT gcm_regid FROM $px_table_name";
$res = $wpdb->get_results($sql);
if ($res != false) {
    foreach($res as $row){
        array_push($devices, $row->gcm_regid);
    }
}

return $devices;
}

function px_canonical($answer) {
$allIds = px_getIds();
$resId = array();
$errId = array();
$err = array();
$can = array();
global $wpdb;
$px_table_name = $wpdb->prefix.'gcm_users';

foreach($answer->results as $index=>$element) {
if(isset($element->registration_id)) {
 $resId[] = $index;
}
}

foreach($answer->results as $index=>$element){
if(isset($element->error)){
  $errId[] = $index;
}
}

if($resId != null) {
    for($i=0; $i<count($allIds); $i++) {
        array_push($can, $allIds[$resId[$i]]);
    }
}

if($errId != null) {
    for($i=0; $i<count($allIds); $i++) {
        array_push($err, $allIds[$errId[$i]]);
    }
}

if($err != null) {
for($i=0; $i < count($err); $i++){
    $s = $wpdb->query($wpdb->prepare("DELETE FROM $px_table_name WHERE gcm_regid=%s",$err[$i]));
}
} 
if($can != null) {
for($i=0; $i < count($can); $i++){
    $r = $wpdb->query($wpdb->prepare("DELETE FROM $px_table_name WHERE gcm_regid=%s",$can[$i]));
}
}
}

?>



via Chebli Mohamed