samedi 31 octobre 2015

How can i give my short code a parameter that I can use for my wpdb->insert

I am using the following plugin but I need to have a attribute called player id here. How would I go about that cause I need to be able to use my player id shorcode attribute in my insert as I cant seem to get the post value of a form when im using a short code ?.

<?php
    /*
    Plugin Name: David Buckley Go Green Redeem Points
    Plugin URI: http://ift.tt/1Kcb1BO
    Version: 1.01
    License: Plugin comes under GPL Licence.
    */
    //Include Javascript library
    wp_enqueue_script('gogreen', plugins_url( '/js/readeempoints.js' , __FILE__ ) , array( 'jquery' ));
    // including ajax script in the plugin Myajax.ajaxurl
    wp_localize_script( 'gogreen', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php')));
    function updateRedeemPoints(){
    $playerId = $_POST['playerId'];
    $points=$_POST['points'];
    global $wpdb;
    $wpdb->insert( 
        '4hSIc_pods_player_ranking', 
        array( 
            'points_to_redeem' =>$points,
            'player_id'=>'339393',
            'date_to_be_awarded' => current_time('mysql', 1),
            'approved'=>'false'

        ));


    echo 'test';
    }
    add_action('wp_ajax_updateRedeemPoints', 'updateRedeemPoints');
    add_action('wp_ajax_nopriv_updateRedeemPoints', 'updateRedeemPoints');
            function show_form(){


                echo "<div id='thanks' class='modal fade' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>";
                echo "<div class='modal-dialog'>";
                echo "<div class='modal-content'>";
                echo "<div class='modal-header'>";
                echo "<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>";
                echo "<h4 class='modal-title'>Redeem Points</h4>";
                echo "</div>";
                    echo "<form class='form-horizontal'  class='contact' name='redemmpointsForm' id='redemmpointsForm' >";
                    echo " <div class='form-group'>";
                    echo "<h3>You may only redeem the maxium points of : <?php echo $maxpoints;?></h3>";
                    echo "<input type='hidden' name='playerid' value='<?php echo $playerId;;?>' />";
                    echo "<input type='number'  valuemax='<?php echo $maxpoints;?>' name='points' id='points' class='form-control' placeholder='How many points do you wish to redeem.' />";
                    echo "<label class='control-label col-md-4' for='Comments'>Comments?</label>";
                    echo "<input type='text' name='comments' />";

                    echo "     </div>";
                    echo "    <div class='form-group'>";
                    echo "            <div class='col-md-6'>";
                    echo "                <input type='button' class='btn btn-success' name='submit' id='submit' Text='Submit'>";
                    echo "     <a href='#' class='btn' data-dismiss='modal'>Close</a>";
                    echo "         </div>";
                    echo "      </div>";
                    echo "</form>";
                echo "      </div>";
                        echo "      </div>";
                            echo "      </div>";
        }



    add_shortcode( 'go_greenredempoints', 'gs_redeemplugin' );

    function gs_redeemplugin($atts) {


        ob_start();

         extract( shortcode_atts( array(
            'playerId' => 'myvalue'

        ), $atts ) );




        show_form();
        return ob_get_clean();
    }
?>

Also I wish to echo back a message to the user which I can append onto another messagbox to the end user what is the best way of doing this.



via Chebli Mohamed

How can I disable Yoast SEO's Twitter Cards via PHP?

I am attempting to disable Yoast SEO's Twitter Cards using the hook system. I've been able to disable Yoast's Open Graph using the following method, but for some reason, the Twitter cards refuse to go away. Here's my current code:

// Inside my Open Graph function:
global $wpseo_og; 
remove_action( 'wpseo_head', array( $wpseo_og, 'opengraph' ), 30 );

// Inside my Twitter Card function:
global $wpseo_twitter;
remove_action( 'wpseo_head', array( $wpseo_twitter, 'twitter' ), 40 );

I've seen this code on several forums, but for some reason, only the Open Graph removal seems to be working on my site. Any help would be greatly appreciated.



via Chebli Mohamed

How to get multiple value from different condition, Just like WP Meta Query works?

META TABLE ==
meta_id | post_id | meta_key | meta_value
1       | 101     | quantity | 8
2       | 101     | price    | 100
3       | 102     | quantity | 7
4       | 102     | price    | 56
5       | 103     | quantity | 12
6       | 103     | price    | 256


POST TABLE ==
post_id | name      | about
101     | Pencil    | Luxurious pencil only for you
102     | Eraser    | All your mistakes, gone!
103     | Pen       | Unrivaled penmanship, stronger than sword.

How to do a query to post id and get post : name,about with meta: value, price and quantity in a single go?

so the results will be

 101   | Pencil   | Luxurious pencil only for you   | 8   | 100
 102   | Eraser   | All your mistakes, gone!        | 7   | 56
 101   | Pencil   | All your mistakes, gone!        | 12  | 256

Thank you



via Chebli Mohamed

Delete Custom Post Type Post From A Custom Plugin Page

I am using WP_List_Table in my plugin. and created a custom admin. Listed few post from post type shop_order.

if i delete a order from direct shop_order it works but when i try to delete it using my custom plugin page i get the below Error

You do not have sufficient permissions to access this page.

My page url looks like

http://localhost/wpdev/wp-admin/edit.php?post_type=wc_qd_orders&page=wc_qd_orders&s=&_wpnonce=f2c9c65959&_wp_http_referer=%2Fwpdev%2Fwp-admin%2Fedit.php%3Fpost_type%3Dwcqd_project%26page%3Dwc_qd_orders&action=trash&m=0&dproj=&_customer_user=&paged=1&mode=excerpt&post[]=218&action2=-1

My Code : http://ift.tt/1SesgZF



via Chebli Mohamed

Update wordpress plugins using ssh

I need to update the plugins in my wordpress site using the ssh command line. Any of you knows a save way to do it?

I'll really appreciate your help.



via Chebli Mohamed

vendredi 30 octobre 2015

How to integrate PayPal express checkout?

I'm developing a wordpress plugin that needed the PayPal Express checkout feature.

I was following this article from paypal site on how to Integrating the In-Context Checkout Feature (http://ift.tt/1NcGme4) which gave me the following form on 1 step.

<form method=post action=http://ift.tt/1HfUUmN;
    <input type=hidden name=USER value=API_username>
    <input type=hidden name=PWD value=API_password>
    <input type=hidden name=SIGNATURE value=API_signature>
    <input type=hidden name=VERSION value=XX.0>
    <input type=hidden name=PAYMENTREQUEST_0_PAYMENTACTION value=Sale>
    <input name=PAYMENTREQUEST_0_AMT value=19.95>
    <input type=hidden name=RETURNURL value=http://ift.tt/1NcGlqn;
    <input type=hidden name=CANCELURL value=http://ift.tt/1HfUVHi;
    <input type=submit name=METHOD value=SetExpressCheckout>
</form>

I have added my own API_username, API_password & API_Signature from PayPal but when submitted it shows ACK=Failure.

Following is the message from paypal I'm geting:

TIMESTAMP=2015%2d10%2d30T05%3a27%3a09Z&CORRELATIONID=24cb45b8dd36b&ACK=Failure&VERSION=0%2e000000&BUILD=18308778&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Security%20error&L_LONGMESSAGE0=Security%20header%20is%20not%20valid&L_SEVERITYCODE0=Error

Because of this I cannot go to step 2 on the PayPal documentation, so need help here. What am I doing wrong?



via Chebli Mohamed

jeudi 29 octobre 2015

Is possible share post from my personal facebook account (not page)?

Everyone know way to share in simple widget my facebook post? i would use my personal account not public page.

Every plugin that i find allow to show your fb page post. I have twitter and facebook account and i would share on widget my posts.

Twitter widget allow to share post, Facebook widget allow only share page post. I think is for privacy policy but i try with this post to have any answer.

Thanks all for any help bye V



via Chebli Mohamed

Wordpress infected file handling

/public_html/wp-content/plugins/widget.php: {HEX}.php.generic.cav7.409.FOUND I got this e-mail from my host and it says that it's an infected file , how can i fix it ?



via Chebli Mohamed

I want to cancel old Subscriptions when new Subscriptions will place in woocommerce?

add_action('woocommerce_payment_complete', 'custom_process_order', 10, 1);
    function custom_process_order($order_id) {
        $order = new WC_Order( $order_id );
        $myuser_id = (int)$order->user_id;
        $user_info = get_userdata($myuser_id);
        $items = $order->get_items();
        foreach ($items as $item) {

            if ($item['product_id']==24) {
              // Do something clever
            }
        }
        return $order_id;
    }

i am trying to add woocommerce action hook "woocommerce_payment_complete" to get old subscriptions detail for cancellation , but it doesn't work .

Basically i want the different kind of functionality , let me explain for ex: suppose a customer subscribe $10 product for month but customer added new subscription before month , so I want to cancel old one and add new subscription .

If anyone could suggest me the simplest way to achieve this woocommerce functionality.



via Chebli Mohamed

How to import woocommerce products with tabs to a wordpress page?

I can't find any solutions on the internet, guide I'm following ( http://ift.tt/1kdVLPD ) fails when I have to import products with meta-data (I can't find a free woocommerce plugin that supports meta-data). So I want to have custom tabs on products that I can import. For custom tabs I use Woo Tabs Pro plugin and for import/export custom post I'm using WP Ultimate CSV Importer.



via Chebli Mohamed

WooCommerce Advanced Shipping Restriction

For WooCommerce Advanced Shipping:

I need to have a condition to restrict shipping. Something like is a product is from "x" class and and "Y" class together , No shipping should be available.

Please help in this.

Regards, Deep



via Chebli Mohamed

WordPress Plugin update loop

I create a simple plugin and added it to the WordPress SVN. I added and activated it on one of my client's website. The plugin works fine but has the message

There is a new version of WP-Admin Distribution List available

Keeps poppping even after I updated the plugin using the 'update now' button

My guess is that the copy of WordPress on my client's server is not updating the database with the new info. Can someone tell em what am I missing?
Here's the Plugin



via Chebli Mohamed

Multi-step form navigaion plugins in wordpress

I'm looking for a WordPress form creation plugin that supports multi-step form navigation with validation.For example, step 1 > Step 2 > Step 3 > Finish. and manage all form with backend functionality.

Many thanks in advance for recommendations.



via Chebli Mohamed

How to resolve the conflict between Custom permalink plugin and Polylang

My site uses Custom permalinks plugin and i wan't to have english version of my site. Some pages from different post types are written in custom permalinks. For ex, i go to such page, add translate, publicate translation. Russian page with Custom permalink has url www.mysite/page(instead http://ift.tt/1jTEBHq) and i want(i have added setting in Polylang that before 'page' added /en/) that translated page has url such www.mysite/en/page, i write in admin panel 'page' in slug, but when i watch translated page i have redirect www.mysite/page on Russian version(though Polylang mast add /en/), i've try to write in admin pannel /en/page, but nothing(and in Custom permalink settings page in admin i saw http://ift.tt/1NCIxpC)...i don't have any idea, how to resolve this situation, help me please!



via Chebli Mohamed

OOP and WordPress plugin theme supporting

I'm trying to create the WordPress plug-in using OOP and I got stuck at the beginning. Will be faster if I show code than to describe the problem.

It works:

class Plugin{
    public function __construct(){
        return;
    }
 }
 function customHeader(){
     add_theme_support('custom-header');
 }
 add_action( 'after_setup_theme', 'customHeader' );

But it doesn't:

class Plugin{
    public function __construct(){
        if (is_admin()) {
           add_action('admin_init', array($this,'admin_init'));
        }
    }
    public function admin_init(){
        add_action( 'after_setup_theme', array($this,'customHeader') );
    }
    public function customHeader(){
        add_theme_support('custom-header');
    }
}
$plugin=new Plugin();

Do you have any idea why it doesn't work and where there is a mistake ?



via Chebli Mohamed

Local Wordpress Site Traffic Monitor

I have a Wordpress site deployed locally on company's server for local access, what tool, plugin or any method could I use to monitor traffic and hit statistics for the site, I want to see hit reports for each page on different time spans.

Thank you.



via Chebli Mohamed

mercredi 28 octobre 2015

Which is faster from querying posts in wordpress

I would like to ask which is faster regarding querying posts in wordpress.

Is it better to create a new table for new data then make a custom SELECT statements or is it better to use the default wp_posts and wp_postmeta table and use the built in query functions of wordpress?



via Chebli Mohamed

How can I add custom php include() file in wordpress

In my wordpress theme, there is a page name pre-registration. if I take there any HTML form, that work but I need a congig.php file for MySQL query for this page. Please help me to add a include(); file at that page.



via Chebli Mohamed

Background Images on Previous Page Breaks Masonry Infinite Scroll

I am building a project that uses Masonry.js and the Infinite Scroll plugin for wordpress. And it works. Correctly scales. No problems on refresh.

However, when I link from pages that use css background with an image url. It breaks. When I remove those elements or even change background to a color instead of an image, I can navigate to the blog without breaking masonry. Images for the backgrounds are a manageable 1200 x 600.

I can't wrap my head around why css on a referer page would disrupt the js that starts on load on the blog.



via Chebli Mohamed

Change CSS Recent Posts widget in WordPress

I'm currently using the Recent Posts widget that comes with WordPress. Is it possible to change the CSS of the links? I want the font to be smaller and not display in bold as it does now. I know it inherits these settings (bold links and font size), but I would like to overwrite them. Many thanks!



via Chebli Mohamed

Change post url depending on language

I have a Web page that has a blog. It has a static home page, and you can access the menu using the top menu.

When I visit the main blog, it looks like:

www.mysite.com/blog

When I go to the translated blog (in this case, the English version) it looks like:

http://ift.tt/1kRg0mM

I want it to look like:

http://ift.tt/1S9fnA0

I used permalinks like this:

/blog/%postname%/

I tried:

/blog/%lang%/%postname%/ With no luck...

How can I make it sensitive to languages?

EDIT: Plugins I'm using:

  • Polylang
  • Lingotek


via Chebli Mohamed

Custom taxonomy archive list - Wordpress

I want to display a custom taxonomy page.

    $microblogging_taxonomy_slug="theme";
    $microblogging_taxonomy_singular="theme";
    $microblogging_taxonomy_plural="themes"

    $labels = array(
        'name'              => $microblogging_taxonomy_plural,
        'singular_name'     => $microblogging_taxonomy_singular,
        'search_items'      => sprintf( __( 'Search %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_plural) ),
        'all_items'         => sprintf( __( 'All %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_plural) ),
        'parent_item'       => sprintf( __( 'Parent %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_singular) ),
        'parent_item_colon' => sprintf( __( 'Parent %s :',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_singular) ),
        'edit_item'         => sprintf( __( 'Edit %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_singular) ),
        'update_item'       => sprintf( __( 'Update %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_singular) ),
        'add_new_item'      => sprintf( __( 'Add new %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_singular) ),
        'new_item_name'     => sprintf( __( 'New %s',LANGUAGE_MICROBLOGGING ), strtolower($microblogging_taxonomy_singular) ),
        'menu_name'         => $microblogging_taxonomy_plural,
    );

    $args = array(
        'hierarchical'      => false,
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array( 'slug' => $microblogging_taxonomy_slug ),
    );

    register_taxonomy( MB_CUSTOM_TAX_1_NAME, array( "post" ), $args );

now I want to create a template for this page "mysite.dev/theme/". Is it possible?

I create this taxonomy with a plugin and so I would use a filter like

add_filter( 'taxonomy_template', 'mb_get_custom_taxonomy_template' );

For example I use a function, attached to the 'archive_template' filter hook, to replace tax original theme template

 function mb_get_custom_post_type_template_archive($archive_template)   {
     global $taxonomy,$term,$wp_query;
     global $mb_css_js_version;

     if (is_tax() && $taxonomy == MB_CUSTOM_TAX_1_NAME) {

        $archive_template = MB_TEMPLATE_CUSTOM_TAX_1_DIR . "index.php";

     }
     else if (is_post_type_archive(MB_POST_TYPE)) {

        $archive_template = MB_TEMPLATE_ARCHIVE_DIR . "post_type_archive/index.php";
     }
     return $archive_template;
}

With this function I can view my plugin template

ex. http://ift.tt/1GIv5AO http://ift.tt/1k9AuXa



via Chebli Mohamed

I remove a catefory in wordpress but google search always show it

i use wordpressframework , and create sitemap by seo plugin, when i remove a category, google search always show my_domain/remove_category. how i cant fix it? thanks all



via Chebli Mohamed

mardi 27 octobre 2015

Unable to create directory wp-content/uploads/2015/10. Is its parent directory writable by the server?

When I browse plugin and click to install now it will give this message ( Unable to create directory wp-content/uploads/2015/10. Is its parent directory writable by the server? )



via Chebli Mohamed

About WordPress plugin publication

I have two simple questions for WordPress plugin developers who published their paid plugins in different marketplaces. Question-1: Should I encrypt the code before publishing the paid plugin ? Question-2: Is it necessary to take licence for the plugin? Thanks in advance.



via Chebli Mohamed

Change post url

I have a Web page that has a blog. It has a static home page, and you can access the menu using the top menu.

When I visit my site, it looks like:

www.mysite.com

When I go to my blog, it looks like:

www.mysite.com/blog

But when I visit a post, it looks like:

http://ift.tt/1XwWb27

And I want it to look:

http://ift.tt/1PSvuCT

How can I achieve this? Is there any way without plugins? Or maybe, any plugin that won't crash anything?

Thank you!



via Chebli Mohamed

Exclude images from lightbox in "Photo Swipe Masonry"

i am using the "Photo Swipe Masonry" plugin (version 1.0.6) on wordpress 4.3.1. It works perfect so far.

But, i have some images which have a custom link to an external url(instead of the stadard to the image). If i click one of these images, it opens the url in a new window. That works like expected. Now, when i click on an standard image(no external url), the lightbox opens and the image is displayed like expected.

But now, when i use the prev/next buttons to navigate through the images and i reach an image with a custom link, i got the errormessage:

"The image could not be loaded" (in the lightbox).

So, my question is, how to exclude images from being added to the lightbox? Maybe by a unique class ?

Any help is highly appreciated.

Many thanks in advance to all of you for your time.

Regards, Joe



via Chebli Mohamed

Changes not showing after update, deleting cookies and clearing cache.

I updated code for one of my plugins, and changed it in the server.

I cleared browsers cache and deleted cookies.

But for some reason the change is not showing. Any suggestions why?

I'm using Wordpress.



via Chebli Mohamed

Woocommerce shipping plugin with 3 carriers

for the online store I need option for users to choose from 3 different shipping carriers I define. Is there any options like that inside woocommerce or plugin that can add that.

So once user checkout, he needs to choose 1 from 3 different carriers I use for my store in Germany.

Was searching online but were not able to find anything.

Thanks!



via Chebli Mohamed

Visual Composer Builder - YouTube Video No Sound

I am using the Visual Composer builder for WordPress - I've added a background YouTube video that plays perfectly fine, however there is no sound at all. On the demo theme the sound for the video is playing. Also another thing i have noticed is that when the video is playing you get an advert popup at the bottom of the video.

I'm wondering has anyone else come across this problem before and if so, how can it be fixed?

There is no Javascript/jQuery errors.

Site URL

Theme URL

thanks in advance



via Chebli Mohamed

How to know that a existing plugin is compatible to genesis framework or not. If not then how to make it compatible to it

I have created a list of plugins according to my project requiremnt and selected genesis framework for the development purposes. But before buying framework and plugins I want to sure about their compatibility.

If the list is not compatible with genesis then should I go for list of plugins that are compatible to genesis.



via Chebli Mohamed

Auto Call a function after say 16 hours after a post is posted in wordpress website

I have a mail trigger functionality to implement, I'm using anspress wordpress plugin for question/answer thing and the scenario here is like, if a question is unanswered for say some 16 hours a mail should me triggered to a Expert Users group saying a post is unswered for such a long time.

Now I have the code for sending email and i'm retrieving the posts also which are left unanswered, But how to trigger this function 16 hours after a post is posted.



via Chebli Mohamed

lundi 26 octobre 2015

Network Deactivate woocommerce From Multisite (Not working)

I have wordpress multi-site with wooCommerce plugin activated on a network. I don't want wooCommerce for 2 of my sub-sites. So I decided to network deactivate wooCommerce and activate separately on only sub-sites which require shop.

So I deactivated from the network and was trying to activate on one of my sub-site. It didn't work, instead my mysql server went down and stopped running. All of my websites went down. After server started, I manually deleted active_plugins value from wp_options. It had started again all websites. I repeated this process thrice but not succeeded. Later, I disabled all network active plugins and then tried activating wooCommerce from one sub-site. This time it worked, but again after this, I couldn't able to activate other plugins back which I deactivated before (those are Awesome support and CKEditor for Wordpress).

Now, I again switched back to old setup where wooCommerce activated on whole network which is running good. I am looking for a solution to activate wooCommerce only on 2 sub-sites.



via Chebli Mohamed

Wordpress plugin for poll that spans multiple pages (or code ideas)

Ok so this will be a very specific question, but I have a client who wants to have several poll questions across various pages, and each time that you answer a question it will show the running results, for example 42% Yes, 58% No.

This first aspect isn't so complex, I could have figured tha out just fine - the kicker is that at the end of the series of pages there will be a results page that shows all the questions that you answered and, based on the result, a list of tips and tricks for you.

If it was just a poll it wouldn't be so bad, but the poll questions will just be a small part of the overall page (it will be kind of like a multi-page mini-course with short lessons on each page). I don't see any way this without PHP or Javascript, unless someone has a plugin to recommend (even premium, Codecanyon, etc).

Thanks!



via Chebli Mohamed

Integrating FullPage.js as a Wordpress Plugin: Can I adjust this plugin to work along side other plugins?

I recently followed this post on integrating FullPage.js as a WordPress plugin.

I'm having trouble getting the plugin to work with other plugins - such as "All in one Event Calendar". The calendar works it just won't display on pages using FullPage.js

I understand the limitations that a plugin meant for landing pages has, but I was wondering if there was any way to edit the existing FP plugin template so that it can utilize other plugins while also taking over the theme's template?

Perhaps editing this statement?:

function fullpage_template( $original_template ) {

  if ( get_post_meta( get_the_ID(), 'fullpage_js', true ) ) {
  return dirname(__FILE__) . '/templates/fullpage.php';
  } else {
  return $original_template;
  }

}

I really appreciate any assistance on this!



via Chebli Mohamed

Contact form 7 - The dreaded spinning circle

Hi im pretty new to Wordpress and form some reason I have been asked to manage I wordpress site: http://ift.tt/1MeYD5k. When I was given access, the previous web master didn't update anything - so I am not sure if this plays a part on why I am getting a spinning loading circle.

Here's the question: My Contact Form 7 isn't working. After typing in the fields, I just get a loading symbol and the form doesn't send?

Help!? Not sure what to do.



via Chebli Mohamed

Essential Grid For Wordpress filtration dropdown needed

I have on essential grid of filtration which I added to the menu, but the problem arises in this instance that when I click. Interiors I'd like to tell me when clicking developed further filtering of elements in the selection.



via Chebli Mohamed

instagram. show the total amount of posts from the user

i am displaying an instagram feed using the wordpress plugin "instagram slider widget".

is it possible to show the total post count? how many post this acount has posted?

using this plugin or using the instagram api.

Thx



via Chebli Mohamed

Can't hide price if it's equals to 0 in Essential Grid Wordpress Plugin

Hi I am Newbie to Javascript and JQuery so sorry if it's a simple issue but i've been trying to solve it for hours and didn't succeeded... :(

I am using Essential Grid Plugin for Wordpress and on each frame of galley picture I have price , some of them are free so the price that shown is $0 what i've been trying to do is to hide this price if its $0;

tried many options that had a right syntax but none of them worked for example :

JQuery(document).ready(function(){
  var amount =  $('.amount').val();
  if(amount == '$0'){
  jQuery('.amount').hide();
});

$amount =  $('.amount').val();
if($amount == '$0'){
 jQuery('.amount').hide();
}

and others,,, but the only thing is worked is this line ...

jQuery('.amount').hide();

All of those i've tried to implement in Essential Grid API/Javascript (special area for javascript) enter image description here



via Chebli Mohamed

Custom Options(image or file) in WooCommerce

I want to show Custom Option's image or file instead of image or file name in order view page in admin and order page in my account in front end of woocommerce.

I have used this hook:

woocommerce_add_order_item_meta()

and add data in order meta but only image name is shown but not the image.

this is my function:

function order_item_meta($item_id,$values) {




        if ( ! empty( $values['options'] ) ) {

            foreach ( $values['options'] as $options ) {


                $name = ucwords(str_replace('_', ' ', $options['name']));

                if ( $options['price'] > 0 ) {

                    $name .= ' (' . woocommerce_price($this->get_product_addition_options_price( $options['price'] ) ) . ')';
                }

                if ( $options['option_price'] > 0 ) {

                    $name .= ' (' . woocommerce_price($this->get_product_addition_options_price( $options['option_price'] ) ) . ')';
                }

                  wc_add_order_item_meta( $item_id, $name, $options['value'] );


            }
        }



    }

This code add all options correctly, but it show image name of an image instead of showing image itself, but i need to show image.



via Chebli Mohamed

how to hide activated menu link from wp-admin dashboard

get list of activate plugin in wordpress and remove plugin link from admin menu .i want to remove activate plugin link from admin sidebar. how can this be done ?. how to hide activate menu link from wp-admin dashboard



via Chebli Mohamed

dimanche 25 octobre 2015

How can I embed CodeMirror into WordPress comment?

I am developing a plugin which will allow user to add code snippets into the comment(Same like Stackoverflow when we post answers or questions). So for that I am using CodeMirror. But here problem is that Wordpress takes comment_content into from textarea. I have to add multiple div's inside comment_content. How can I do that?



via Chebli Mohamed

samedi 24 octobre 2015

how to add meta data to all images in media library wordpress

I need some help on looking for a plugin or php script that can add meta tags to all my images inside wordpress media library

so that when I add in for example a meta description, then it would add it to all the images

and will also display when you right click on the image/details it will display the meta description

could not find any for this, thanks



via Chebli Mohamed

Need help setting up Shipping rates with WooCommerce

I want to add a shipping charge of Rs.49 on all order below Rs.299 and want to offer frees shipping on all the orders above Rs.299

How Can achieve this ?

I'm using Wordpress with WooCommerce Plugin.



via Chebli Mohamed

avoid wordpress plugin file caching during development

I noticed that changes made strictly to plugin file does not instantly available after plugin page refreshing in /wp-admin/ and thus I suspect the object caching is taking place, as the blog itself does not have any caching plugin installed.

is there any way to disable caching for my plugin during development process ?

tried:

wp_cache_flush();



via Chebli Mohamed

vendredi 23 octobre 2015

Plugin Development for QPay Payment Integration

I am Working on wordpress site.In that i had done add to cart funtionality.if we proceeed furture for the payment, payment should be done with QPay payment gateway. I don't know how to do it ? I have no idea about plugin development. Can I get any suggestions, links that it may help me in QPay plugin development.?



via Chebli Mohamed

Wordpress expires session when refresh page

I was working on wordpress and currently I met a problem with session. I used the theme twentyfourteen. After I login it show admin page but when I refresh page, I show login again???

How to prevent this in wordpress??



via Chebli Mohamed

Facebook error : This content is no longer available. How to resolve it?

i recently created a wordpress blog for one of my client and added SUMOME for the social sharing, well sumome is a social sharing plugin available for wordpress. Initially it was working fine but i dont know why it is kind of acting little weird. Now when ever i try sharing it on facebook it gives me an error saying

This content is no longer available
The content you requested cannot be displayed right now. 
It may be temporarily unavailable, the link you clicked on may have expired, or you may not have permission to view this page.

i tried putting the open graph meta tags and included the following code in my functions.php

function doctype_opengraph($output) {
return $output . '
xmlns:og="http://ift.tt/OQX3IK"
xmlns:fb="http://ift.tt/zbanWc"';
}
add_filter('language_attributes', 'doctype_opengraph');

function fb_opengraph() {
   global $post;

   if(is_single()) {
     if(has_post_thumbnail($post->ID)) {
        $img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium');
    } else {
        $img_src = get_stylesheet_directory_uri() . '/img/opengraph_image.jpg';
    }
    if($excerpt = $post->post_excerpt) {
        $excerpt = strip_tags($post->post_excerpt);
        $excerpt = str_replace("", "'", $excerpt);
    } else {
        $excerpt = get_bloginfo('description');
    }
    ?>

<meta property="og:title" content="<?php echo the_title(); ?>"/>
<meta property="og:description" content="<?php echo $excerpt; ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="<?php echo the_permalink(); ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:image" content="<?php echo $img_src; ?>"/>

<?php
 } else {
     return;
 }
 }
 add_action('wp_head', 'fb_opengraph', 5);

so can someone help me out with this. I also tried using yoast seo..but still with no luck



via Chebli Mohamed

Ultimate Member cant output value of custom field in core/um-actions-profile.php

I am using Ulitmate member Plugin http://ift.tt/1xqmkXs As I am doing a very heavy custom page im editing the core file directly or is this not the advised way of doing it cause I am trying to control the layout in acordance to my theme by outputtin the value from the custom field.

Is their another file I am ment to do custom stuff in

Trying the following in core/um-actions-profile.php:

<?php__('Points,'ultimatemember');  um_get_option('player_points');?>

But its just not ouputting anything but yes I ahve tried and checked their is a value in the user meta of player_points.



via Chebli Mohamed

Website gone from google with any worpdress Seo Plugin

I have a problem with Seo plug-in when i active a plugin in my website it's look fine but after a 3 days the site gone from Google search. I have tried with another plugin and the same things. If i disabled the seo plug-in like now, the website comeback to google search.

I tried All in one Seo pack , and Yaost Seo.

Any suggestion ?

http://ift.tt/1LREo1v



via Chebli Mohamed

Wp plugin can't recieve ajax post data

i am trying to develop a wp plugin that will send a variable to my server. So far if i use my code bellow as seperate php file and not within my script works great.. it sends the variables and recieve the results from remote php file.

If i put the same code in my custom wp plugin it doesn't recieve anything.

my code:

<script>
jQuery(document).ready(function(){     
jQuery(".adminpnlnshbutton").click(function(){
var usermail = jQuery('#uemail').val();
var userkey = jQuery('#ukey').val();
var dataString = 'usermail='+ usermail + '&userkey='+ userkey;
$.ajax({
type: "POST",
url: "http://ift.tt/1S0Chtd",
data: dataString,
crossDomain: true,
dataType: 'html',
success: function(data) {
alert (data);
}
});
});
});
</script>

And check php:

$m = $_POST['usermail'];
$k = $_POST['userkey'];
$s = " | ";
echo $m . $s . $k;

As wordpress plugin:

<?
add_action('admin_menu', 'test_plugin_setup_menu');

function test_plugin_setup_menu(){
        add_menu_page( 'Test Plugin Page', 'Tes Plugin', 'manage_options', 'test-plugin', 'test_init' );
}

function test_init(){

if (is_user_logged_in()) { 
?>
<input name="uemail" type="text" id="uemail" value="email" />
<input name="ukey" type="text" id="ukey" value="activation key" />
<div class="adminpnlnshbutton">SEND</div>
<script>
jQuery(document).ready(function(){     
jQuery(".adminpnlnshbutton").click(function(){
var usermail = jQuery('#uemail').val();
var userkey = jQuery('#ukey').val();
var dataString = 'usermail='+ usermail + '&userkey='+ userkey;
$.ajax({
type: "POST",
url: "http://ift.tt/1S0Chtd",
data: dataString,
crossDomain: true,
dataType: 'html',
success: function(data) {
alert (data);
}
});
});
});
</script>
<?
}
}
?>

any idea why i can't recieve the data inside my plugin?



via Chebli Mohamed

How can the cobble view of the Essential grid plugin, be modified in order to show the title at all times under the post image?

I am using the Essential grid plugin on my website, with the "Cobbles" view enabled. I am trying to make the posts titles always show under the image, not just on hover.

I am aware that this is possible if the "Masonry" option is selected, however this option looks a bit messy on the page.

Is there any chance that someone attempted to do this ?

Thank you!



via Chebli Mohamed

Woocommerce variable protect "No products matched your selection"

Recently a site we built that was working just fine has had a issue with one of it's products. viewing the products gives the message Sorry, no products matched your selection. Please choose a different combination. While also not being able to select a new option.

I've so far done the following:

  1. Checked every option for the product/admin to the working dev site, there were no differences.
  2. Deleted the variations, deleted the attributes, then recreated the attributes and variations on the product.
  3. Tried to create a new product wit the same options.
  4. Updated the woocommerce databass (There was a notice satying it needed doing but the plugin was not updated).

I had assumed this was because of an update to wordpress recently but going back to a backup a few days before this was reported there were no differences between the files.

After extensive googling the only issues i can see like this are from incorrect options selected, or for a similar error with products not displaying in categories, but the product was working and no changes seem to ave been made to the product or the files.

this is occuring with WordPress 4.3.1 and WooCommerce 2.4.7



via Chebli Mohamed

Affiliates registration with invitation code + Compatible with Pmpro

I am using PMPro(Paid membership pro) plugins and i want like D1 register and after some time D2 register but at time of D2 registration D2 enter invitation code of D1 then some of the amount goes to D1 account.

I have also used Paid Memberships Pro - Invite Only Add On plugins but how to integrate this two plugins so that my functionality achieve.



via Chebli Mohamed

Want to display woocommerce order by (dropdown) right after title

Removed the woocommerce ordering drop down displayed on category page by editing in function file (remove action) so now i want that drop down right after the title of category page what can i do?

remove_action('woocommerce_before_shop_loop','woocommerce_catalog_ordering',30);



via Chebli Mohamed

jeudi 22 octobre 2015

Wordpress.org oEmbed Gist Plugin - text display alignment issue

Environment

  • Wordpress 4.3.1
  • oEmbed Gist Plugin version 2.0.0

The Problem

See this Sample Blog webpage - for some reason the texts have become "way-too-left-aligned", causing the texts towards the left edge not visible any more.

This problem did not exist before (texts used to display ok and all visible within the border) - I noticed this only about a couple of weeks ago - not sure if it's cause by some kind of updates / unknown factors. (Anyone got similar issues and how to resolve this?)

Here is a snapshot of the current problematic state:

enter image description here



via Chebli Mohamed

wordpress reading static page display posts orderd by date desc

Hello i'm kinda new to wordpress and i struggle making a static page displaying posts order by date desc. They are displayed after title and i don't manage to make it work as it should. Here is my page code:

<?php 
/*
Template Name: Full Width
*/ 
?>
<?php 
global $wp_query;
$id = $wp_query->get_queried_object_id();
$sidebar = get_post_meta($id, "qode_show-sidebar", true);  

$enable_page_comments = false;
if(get_post_meta($id, "qode_enable-page-comments", true) == 'yes') {
    $enable_page_comments = true;
}

if(get_post_meta($id, "qode_page_background_color", true) != ""){
    $background_color = get_post_meta($id, "qode_page_background_color", true);
}else{
    $background_color = "";
}

if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }

?>
    <?php get_header(); ?>
        <?php if(get_post_meta($id, "qode_page_scroll_amount_for_sticky", true)) { ?>
            <script>
            var page_scroll_amount_for_sticky = <?php echo get_post_meta($id, "qode_page_scroll_amount_for_sticky", true); ?>;
            </script>
        <?php } ?>
            <?php get_template_part( 'title' ); ?>
        <?php
        $revslider = get_post_meta($id, "qode_revolution-slider", true);
        if (!empty($revslider)){ ?>
            <div class="q_slider"><div class="q_slider_inner">
            <?php echo do_shortcode($revslider); ?>
            </div></div>
        <?php
        }
        ?>
    <div class="full_width"<?php if($background_color != "") { echo " style='background-color:". $background_color ."'";} ?>>
    <div class="full_width_inner">
        <?php if(($sidebar == "default")||($sidebar == "")) : ?>
            <?php if (have_posts()) : 
                    while (have_posts()) : the_post(); ?>
                    <?php the_content(); ?>
                    <?php 
 $args_pages = array(
  'before'           => '<p class="single_links_pages">',
  'after'            => '</p>',
  'pagelink'         => '<span>%</span>'
 );

 wp_link_pages($args_pages); ?>
                    <?php
                    if($enable_page_comments){
                    ?>
                    <div class="container">
                        <div class="container_inner">
                    <?php
                        comments_template('', true); 
                    ?>
                        </div>
                    </div>  
                    <?php
                    }
                    ?> 
                    <?php endwhile; ?>
                <?php endif; ?>
        <?php elseif($sidebar == "1" || $sidebar == "2"): ?>        

            <?php if($sidebar == "1") : ?>  
                <div class="two_columns_66_33 clearfix grid2">
                    <div class="column1">
            <?php elseif($sidebar == "2") : ?>  
                <div class="two_columns_75_25 clearfix grid2">
                    <div class="column1">
            <?php endif; ?>
                    <?php if (have_posts()) : 
                        while (have_posts()) : the_post(); ?>
                        <div class="column_inner">

                        <?php the_content(); ?> 
                        <?php 
 $args_pages = array(
  'before'           => '<p class="single_links_pages">',
  'after'            => '</p>',
  'pagelink'         => '<span>%</span>'
 );

 wp_link_pages($args_pages); ?>
                            <?php
                            if($enable_page_comments){
                            ?>
                            <div class="container">
                                <div class="container_inner">
                            <?php
                                comments_template('', true); 
                            ?>
                                </div>
                            </div>  
                            <?php
                            }
                            ?> 
                        </div>
                <?php endwhile; ?>
                <?php endif; ?>


                    </div>
                    <div class="column2"><?php get_sidebar();?></div>
                </div>
            <?php elseif($sidebar == "3" || $sidebar == "4"): ?>
                <?php if($sidebar == "3") : ?>  
                    <div class="two_columns_33_66 clearfix grid2">
                        <div class="column1"><?php get_sidebar();?></div>
                        <div class="column2">
                <?php elseif($sidebar == "4") : ?>  
                    <div class="two_columns_25_75 clearfix grid2">
                        <div class="column1"><?php get_sidebar();?></div>
                        <div class="column2">
                <?php endif; ?>
                        <?php if (have_posts()) : 
                            while (have_posts()) : the_post(); ?>
                            <div class="column_inner">
                            <?php the_content(); ?>     
                            <?php 
 $args_pages = array(
  'before'           => '<p class="single_links_pages">',
  'after'            => '</p>',
  'pagelink'         => '<span>%</span>'
 );

 wp_link_pages($args_pages); ?>
                            <?php
                            if($enable_page_comments){
                            ?>
                            <div class="container">
                                <div class="container_inner">
                            <?php
                                comments_template('', true); 
                            ?>
                                </div>
                            </div>  
                            <?php
                            }
                            ?> 
                            </div>
                    <?php endwhile; ?>
                    <?php endif; ?>


                        </div>

                    </div>
            <?php endif; ?>
    </div>
    </div>  
    <?php get_footer(); ?>



via Chebli Mohamed

Git merge updated WordPress plugins

I have a few WordPress plugins which required updates. I know that there were changes to the plugin files made by myself and others which would be overwritten by updating the plugins. I don't know where all changes were made since other people made some of them.

I updated plugins and pushed them to a separate branch. So, I had the master branch with all the changes made to the plugins, and an updated branch which overwrote those changes. I merged both branches together and there were no conflicts.

Am I right to think that the changes previously made to the plugin files have been successfully merged with the updates or is it likely I lost some of them?

The git branches look something like this:

           -----Updated Plugins----
          /                        \
         /                          \
------Master-----------------------Merged Branch----



via Chebli Mohamed

Why is $wp_query->post unset during 404?

I am using a plugin called Connections. When a 404 occurs (for good reason, i.e. a page that doesn't exist is accessed via the browser) then the custom post callback filter, specified in the plugin's code breaks, as $wp_query->post is unset. We get the complaint Trying to get property of non-object when $wp_query->post->ID is accessed. As you would expect.

I have disabled all other plugins and gone back to Twenty Fifteen theme but the issue still occurs. On a clean install the problem doesn't occur. This doesn't make sense to me. If it's not a plugin or theme issue and it's not in the Wordpress core then where is the issue? A corrupt database? (everything else seems to be working fine).

If I put

public static function filterPostTitle( $title, $id = 0 ) {
   global $wp_query, $post, $connections;

   // ADDED: If I add this line the problem goes away.
   if ( is_404() ) return $title;

   // Whether or not to filter the page title with the current directory location.
   if ( ! cnSettingsAPI::get( 'connections', 'connections_seo', 'page_title' ) ) return $title;

   // If I uncomment the next two lines and comment out the following line of code, then the problem also goes away.
   //$post_id = get_queried_object_id();
   //if ( ! is_object( $post ) || $post_id != $id || ! self::$filterPermalink ) return $title;

   if ( ! is_object( $post ) || $wp_query->post->ID != $id || ! self::$filterPermalink ) return $title;

If I add the following check at the start of the function then the problem also goes away (again as we'd expect):

if ( ! isset( $wp_query->post ) || ! isset( $wp_query->post->ID ) ) return $title;

I have printed out backtraces to give me clues, however the backtraces don't seem to give many clues as the global variable $wp_query is at fault. This is another reminder why globals are bad practise... a very poor show for Wordpress. Globals make debugging a nightmare. Where is the global variable changed? We don't know.

The filter callback is set up as follows:

add_filter( 'the_title', array( __CLASS__, 'filterPostTitle' ), 10, 2 );

The developer of the plugin (maybe rightly so) thinks the problem lies outside of his plugin.

QUESTION: Why is $wp_query->post unset at the time of the callback being triggered? Should $wp_query->post always be set by the time a 'the_title' filter callback is triggered?

As you may guess I am fairly new to Wordpress. It's mostly fantastic... not a fan of the global variables though... a big no-no.



via Chebli Mohamed

H5P timeline alignment

I have a running website that has a H5P timeline that works really well in chrome but in Firefox its outside the canvas and off to the side. The website is here:

http://ift.tt/1n0Rtsf

If you scroll down a little bit you will see the timeline developed in H5P. This timeline should show under the heading "Our History". It does this in Chrome, but in Firefox it appears to the right of the heading, to a large part outside the window.

Any help would be greatly appreciated!



via Chebli Mohamed

Force WP to keep the image size same

I'm using Phogra theme for my images. I've uploaded the stuff, created pages(sub-pages), every thing seems to be working fine, but when I click on some Album(HERE, let's say on Wedding OR Events), that album get loaded to Slider(obvious), but I've images of different sizes for different images, so when I click on album, some images get cropped automatically, and some are stretched. I really want to keep the images in their original size.

WP version Version 4.3.1.

Thanks in advance for your help.



via Chebli Mohamed

WordPress: How can I disable Gravity Forms inclusion of jQuery?

I am including jQuery already on my website, but when using some conditional logic with Gravity Forms, it includes jQuery again, as well as its own scripts of course.

Output looks like:

<script type='text/javascript' src='//localhost:8080/wp-includes/js/jquery/jquery.js?ver=1.11.3'></script>
<script type='text/javascript' src='//localhost:8080/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='//localhost:8080/wp-content/plugins/gravityforms/js/jquery.json.js?ver=1.9.14'></script>
<script type='text/javascript' src='//localhost:8080/wp-content/plugins/gravityforms/js/gravityforms.min.js?ver=1.9.14'></script>
<script type='text/javascript' src='//localhost:8080/wp-content/plugins/gravityforms/js/conditional_logic.min.js?ver=1.9.14'></script>

What I would like to do is to keep the Gravity Form's scripts, but exclude their inclusion of jQuery and jQuery migrate. I include these myself and do not want GF to do this for me.

I have searched for the handle that includes these scripts, but cannot find the correct hook. I had the following, but it also excluded the GF scripts, which is obviously not what I want to happen:

function remove_unwanted_assets() {

    // Gravity Forms plugin.
    wp_deregister_script('jquery');

}

add_action('wp_enqueue_scripts', 'remove_unwanted_assets', 100);

This seems to exclude everything from GF.

Any help or guidance is much appreciated. Thanks.



via Chebli Mohamed

Wanna change image at client side too after change at server side

I have an embedded program that is changing an image at server side when submit button pressed.At serverside it is completely works but at client side when i'm refreshing pressing F5 then only the change occurs. I am using wordpress and one page is having .I am new in wordpress and PHP.



via Chebli Mohamed

Creating a hidden wordpress plugin

My question might sound stupid but is there any way where I can create a WP plugin which when placed in Plugins folder does not appear in WP Admin Console and WP Admins/Users can't deactivate it from UI?



via Chebli Mohamed

How to integrate Payumoney in Paid membership Pro wordpress plugin

I have a wordpress site. I have installed paid membership pro plugin, I need to integrate Payumoney gateway.



via Chebli Mohamed

Echo Post ID from Post Slug or Post Title

I try to get a post ID based on the post tile or slug (doesn't matter to me which one). After that I want to add the ID to a shortcode.

Working code

<?php 
    $test123 = get_post(30);
    echo $test123->ID; /* this works and returns 30 */
?>

<?php 
echo do_shortcode("[shortcode id='{$test123->ID}']"); /* this also works */
?>

So the next step is get the post ID based on slug or title. How do I do this? I tested different codes but nothing works till so far.

Many thanks for any help in advance!



via Chebli Mohamed

mercredi 21 octobre 2015

I need help to write a script that searches for URLs using a specific plugin with a specific line of text in the URL?

I am stuck on this big time.

I want to write a script that brings up URLs running WP with the text /giveaways/

I would really appreciate some help.



via Chebli Mohamed

Creating a Wordpress plugin to automate my work, can't get it to work

I'm creating a wordpress plugin to automatically make a bunch of pages from a dataset I have that I'll covert to an array. Here's my code so far;

<?php
   /*
   Plugin Name: Create Pages Plugin
   Description: a plugin to create pages programatically
   Version: 1.0
   Author: DJ Khaled
   */
function myplugin_activate() {
    global $user_ID;
    $array22 = array(
        "example1" => "example-1",
        "examaple2" => "example-2"
    );
    foreach ($array22 as $key => $value) {
        if (is_admin()){
            $page_title = $key;
            $page_content = '<p>Hello World</p>';
            $page = array(
                'post_type' => 'page',
                'post_title' => $page_title,
                'post_content' => $page_content,
                'post_status' => 'publish',
                'post_author' => $user_ID,
                'post_name' => $value
            );
            wp_insert_post($page);
            }
        }
    }
register_activation_hook( __FILE__, 'myplugin_activate' );
?>

I'm unsure why these pages aren't created when I activate my plugin. Any help would be appreciated.



via Chebli Mohamed

Contact Form 7 JavaScript WordPress

I am trying to create a form with some car makes & models dropdowns for WordPress . For example if Ford (from make dropdown) is selected then show a dropdown with F35o and F150 (model dropdown), if Nissan (from make dropdown) is selected then show a dropdown with Patrol (model dropdown). If nothing is selected in make dropdown then hide all model dropdowns.

I have no idea how to get the values from those CF7 snippets.

[select* make id:4 "Chevrolet" "Dodge" "Ford" "GMC" "Jeep" "Nissan" "Toyota"]

[select* model id:1 "F150" "F350"]

[select* model id:2 "Patrol"]



via Chebli Mohamed

jQuery working Chrome Console but not in Chrome Screen

-I am customizing a plugin and I have to add a processing icon(button-loader.gif) while image uploading.

-I customized the plugin and every thing was working fine on Firefox.

-But when I tried on Chrome button-loader.gif is not showing while image uploading.

-Here is the div in my php file which shows loader:

<div class="wdm-uploading">
<img src="<?php echo plugins_url('/images/button-loader.gif', __FILE__); ?>" />
</div>

-CSS file content:

.wdm-uploading {
    display: none;
}

-In my .js file I am showing div when file upload initiates and I hide it when upload completes.

jQuery(curr_img + " + .wdm-uploading").hide();
jQuery(curr_img + " + .wdm-uploading").show();

-I ran same above jQuery from Chrome console, It's working. But not working in Chrome screen.

I repeat it works on Firefox and on Chrome console, but not in Chrome browser screen.

Can anybody tell me why it is happening?



via Chebli Mohamed

woocommerce and relevanssi - product search doesn't find product

In my wordpress I have relevanssi plugin.

When I search for a product in product search widget I get no relevanssi.

If I turn off the relevanssi plugin I get results.

The query string: http//http://ift.tt/1QRJcEg

Any idea how to fix it?

Thank you,

Sam



via Chebli Mohamed

mardi 20 octobre 2015

How to import posts from a csv file to WordPress blog Database

I have a csv file with the following columns

Title | Content | Image | Category

I want to import this csv file to WordPress database. I know a csv file can be imported via phpmyadmin. But when i opened the table 'wp_posts' i couldn't find any columns that says image or category.

Are those in another tables? If so how can i import it?



via Chebli Mohamed

Get current user id in a WP plugin with redux framework

I'am workin in a sorter plugin for WordPress, which have Redux Framework installed to manage the options of every section. The plugin uses AJAX to get the ids of all the sections in the homepage of the website, then passes thos values to the plugin main file to process in a function that stores the values in the current user meta. That works well, no problem here. The function looks like this:

add_action( 'wp_ajax_save_sections_ids', 'save_sections_ids_sorting_sections' );      
function save_sections_ids_sorting_sections() {  
    //stuff here...
    $user_ide = get_current_user_id(); //it works because it is inside a hook
    update_user_meta($user_ide, "set-sections", $sections_ids);
    die();       
}

Then I have to get the stored values in user_meta to pass them to the Redux Field, so I wrote other function in the main file of the plugin. The function is this:

function get_the_db_sections_ids() { 
        $user_ide = 1; //This should be get_current_user_id() or something similar, but nothing works, not even globalizing $current_user and using get_currentuserinfo();
        $sections_ids = get_user_meta($user_ide, "set-sections", true);
        $sorter_field = array(
            "section_id" => "basic",
            'id'       => 'homepage-sections',
            'type'     => 'sorter',
            'title'    => 'Control de secciones',
            'desc'     => 'Arrastra y suelta los bloques con los nombres de las secciones, tanto para ordenarlas verticalmente como para desactivarlas o activarlas.',
            'compiler' => 'true',
            'options'  => array(
                'enabled' => array(
                ),
                'disabled'  => $sections_ids
            ),
        );
        return $sorter_field;     

}  

As you notice in the comment in the function above, I have tried several ways, also require_once("/../../../wp-load.php"), but nothing happens. I tried do_action and add_actions, to create a hook, but thos also use global variables, and for what I understand, the global variables do not work in functions with no hooks in plugins.

But I havent finished yet. The really tricky part is, I am calling an instance of Redux class inside the Redux config file (sample-config.php for the demo, I have a custom file, but it is the same).

The instance is Redux::setField($opt_name, get_the_db_sections_ids());

The problem this does not print anything if I call it form a function, or the function linked to the AJAX call.

As you can see, the second parameter of the instance is the function I wrote above that, and it works perfectly if I set $user_ide to 1, but I want the data stores in all admins user_meta, in case user 1 is erased, or whatever.

Is there a way to achive what I want, or to store the data somewhere else and get it from there. I was thinking in creating a custom table in db, and use wpdb to retrieve the data, but I think I can't use wpdb either, because it will be the same problem.

I get the feeling I'm missing something very basic, but I can't get it. Please help.



via Chebli Mohamed

How to submit the content of contact form 7 to external CRM

I would like to submit the content of contact form 7 to external CRM after the email of contact form 7 was sent.

How can I retrieve the data of the form?

Which hook I should use?

How to submit the form to external url?

Thank you,

Sam



via Chebli Mohamed

How to implement custom errors on each field into contact form 7 plugin with lost focus event. anyone guide me please?

I want to show custom errors on each field with lost focus event using contact form 7 plugin. Anyone can help me on this?

Thanks in advance.



via Chebli Mohamed

How to create a wordpress plugin who is working in wp-admin/post.php page

I want to create a wp plugin to show record from database. I have added a table in database and want to fetch and show record in wp-admin post.php page under the post.php page editor.

I have post_id in my table as a foreign key. so I want to fetch record of selected post_id.

This is my plugin code.....

<?php
    /*
        Plugin Name: Kiosk User Info
        Plugin URI: http://pixako.com
        Description: This is Kiosk User Info.
        Author: Muhammad Asfund Yar - Pixako
        Version: 1.0
        Author URI: http://pixako.com
    */

    /* Plugin Main Page/Setting Page*/
    function KioskUserInfo_mainPage(){
        echo "<br />This is main page of plugin<br /> Go to the post page. here we are using it. <br /> Thanks";
    }


    /*Plugin Working Area*/
    function KioskUserInfo_postPage(){
        echo "I want this code to show in wp-admin/post.php page under editor.";
    }
    add_action( 'registered_post_type', 'KioskUserInfo_postPage' );


    /*Menu Links*/
    function KioskUserInfo_menu(){
        add_menu_page('Kiosk User Information Plugin','Kiosk User Info', 'manage_options','kiosk-user-info-mainpage','KioskUserInfo_mainPage');
    }
    add_action('admin_menu','KioskUserInfo_menu');
?>



via Chebli Mohamed

Update Data parameter of a localized script in Wordpress

I'm working in a child theme, In my-page-template.php I have :

//...
$id_curr= 5;
wp_localize_script('my_js', 'ajaxload', array('post_id' => $id_curr)); 

In my_js.js I have an AJAX call :

$.ajax({
   //...
   type: 'post',
   data: {
      action: 'ajax_load',
      post_id: ajaxload.post_id
   }
})


Now in functions.php, I want to edit/update ajaxload.post_id. Is there a way to do that? If I try re-calling wp_localize_script() with the same $name as shown below, will this work?

$id_new=8;
wp_localize_script('my_js', 'ajaxload', array('post_id' => $id_new));  



via Chebli Mohamed

When i try to open admin i get error

Wordpress Web site is working normal but when i try to open /wp-admin i get this error

Parse error: syntax error, unexpected $end, expecting ',' or ')' in /http://ift.tt/1OGPetM on line 341



via Chebli Mohamed

What is the best way to pull and display JSON data from an external API on a Wordpress site?

I need to pull and display JSON from an external API (For example: http://ift.tt/1OGPetH) in a grid on a wordpress site. What is the best way to go about this?



via Chebli Mohamed

How to access wordpress db from plugin javascript file?

I am writing a specific wordpress plugin for my site. I have a form in my plugin and I would like that one of the fields will have auto-suggestions from database table according to the user key types.

How can I accomplish that?



via Chebli Mohamed

blank page after form submit in advanced custom field plugin wordpress

I am using active custom fields plugin to display and submit form in frontend inside buddypress groups page.

Form is submitted and record is entered successfully but a blank page is displayed after form submit. Only the header section of the page is displayed.

I have tried using acf/save_post and acf/pre_save_post hooks to redirect page but none of them seems to work.

Here is my code:

$options = array(
'post_id'       => 'new_post',
'post_title'    => true,
'new_post'      => array(
    'post_type'     => 'event',
    'post_status'       => 'publish'
),
'submit_value'      => 'Create New Event'
);

acf_form($options);

Thanks in advance.



via Chebli Mohamed

Run wordpress plugin in iframe

I have a wordpress audio player plugin (http://ift.tt/1hQleNp) and I need to run it into iframe to keep it always on without stopping the music while I'm surfing the website. Is it possible? there is a way to run a wordpress plugin in a iframe? Thanks.



via Chebli Mohamed

Pods ui listing entries on front end Best Practise?

At presnet I am using the pods.io framework to create my cotent which is great its supper easy but I need way to list user records on front end as said its not best to use

pods_ui

for this as its for back end editing but how do i list the records and send it to a gravity form for editing if anyone has done this type of thing be great if you could explain how you did it.

Ie I want a user to be able to edit a record on the front end. and see only their records of the current pod their looking at?/



via Chebli Mohamed

wp_get_image_editor not working on some servers

I use wp_get_image_editor for image resizing in my plugin new version so that images resized giving dimensions in plugin's settings page by the user, I read full article for this.

In my older version, I resized images via CSS and they stretched if the images dimensions are not relevant to giving width, height in setting's page. So I use wp_get_image_editor for re-sizing the images.

It's working very perfectly. When the user upgrades from older version to newer version, the user goes to listing page of products, the wp_get_image_editor processes and images are re-sized and move to current month folder with rename image and also saved its meta value in DB with foo_big_image and foo_thumb_image meta keys.

But one of my user is gotten an issue with this, he told me that "when I upgraded from older version to newer version my images are not resizing", so I checked it and I found that foo_big_image and foo_thumb_image meta key values are saved blank in DB and images are not moved into folder ... I also checked in my code and when I print this function wp_get_image_editor it prints me out this error.

WP_Error Object
(
    [errors] => Array
        (
            [invalid_image] => Array
                (
                    [0] => The file is not an image.
                )
        )

    [error_data] => Array
        (
            [invalid_image] => http://ift.tt/1ZTLMQa
        )
)

So I asked the user that are the GD and/or ImageMagick libraries active, he told me that it's not active on my current server so he moved his site to another server where GD and/or ImageMagick libraries are active but it's not re-sizing the images, so I checked the code again and printed the wp_get_image_editor but it shows me the above error.

I search this issue, each and every site tells that it's not working when the libraries are not active.

So please help me where I am doing something wrong ... or the libraries not active yet.

Note: I can not use 'add_image_size()' because I am using meta fields for upload images more than one.



via Chebli Mohamed

Collapse Bootstrap 3 Plugins Conflict Wordpress

to whom it may concern,

I'd like some help working out why a bootstrap collapse link is working but not correctly. It's the blue button below the world map on the left of the test site (link below). It should hide the text below when the button's clicked. But when it's clicked it scrolls to the element it's linked to, rather than collapsing the element.

I realise there's a lot of .js scripts that might be overriding the bootstrap collapse function. Is there something I can add as a snippet to make sure there's no conflict? Below is the link to the test site & a link to show the button that's not acting right.

Link here - collapse now fixed

Image link here

Thanks in advance :-]



via Chebli Mohamed

Mysql check if record doesnt exits add it

I want add to wp_postmeta meta_key record if this doesn't exists.

I had this query, but from something strange reason it doesn't work anymore. Please help!

 INSERT INTO wp_postmeta (meta_key, meta_value, post_id)
SELECT '_update_date', '', ID FROM wp_posts WHERE wp_posts.post_type='product'
AND NOT EXISTS  (SELECT meta_key FROM wp_postmeta WHERE meta_key = '_update_date' );



via Chebli Mohamed

lundi 19 octobre 2015

Testing plugins live with Varying Vagrant Vagrants

I'm currently trying to use VVV to develop and test my plugins. My host OS is Win10.

My plugins are in D:\Workshop\projects\vendor\module. I've used this folder structure for a long time, and it is really convenient, especially for use with Composer and friends.

Now I've installed VVV, created a site with VV. I want to test a plugin, the source code of which is in D:\Workshop\projects\XedinUnknown\my-project. So, I create a symlink in D:\Workshop\projects\XedinUnknown\vvv-local\www\my-test-site\htdocs\wp-content\plugins that points to that project's folder. Alas, it doesn't work. If I SSH into VVV and ls /srv/www/my-test-site/htdocs/wp-content/plugins, I can see my-project there, but it points to ../../../../../../../XedinUnknown/my-project, which, of course, doesn't exist. If instead of symlink I create a junction, it's just an empty file.

I suspect that this has to do with how the Linux environment handles Windows symlinks, but I'm not entirely sure. Is it possible to make this work somehow? I really don't wanna copy the whole project folder into VVV.



via Chebli Mohamed

Regex match all expect parameters

I have a particular problem with regex redirect.

Summary:

I have the following structure: http://ift.tt/1XfXa6I

We also have filters at the product level. For example

http://ift.tt/1OERLof

Problem: A lot of the (product-name) the last part of the url gets deleted often, so Google webmaster tools shows those pages as 404.

We redirect the user of the 404 page to the main products directory. For example:

/director/products/product-name (now 404) the user will be redirected to /director/products/. The single product page is meaningless so that's why we don't need the user to go to the single product page, instead the user can find everything on the main products page.

We use the following regex with our plugin to do the redirect

/director/products/(.+)

Now we are running into the problem that the filters also redirect to /director/products/

So /director/products/?filtername=top also redirects to /director/products/

I have tried a number of examples however I can't get the parameters to be excluded from the redirect. Can any expert help me out here?

Thank you



via Chebli Mohamed

Nightclub website using wordpress PHP

I am trying to do a website similar to this on wordpress Sutra Nightclub

Which php code or plugin can I use to add an image slideshow into the header. I used this plugin called metaslider and it runs, it just appears one image.

<!-- Header -->
<html>
<head>
        <title>Graffiti</title>
        <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
</head>
<body>
        <div id="wrapper">
        <div id="header">
                <!---- h1>Grafitti</h1------>
                <?php
                        if (is_front_page() || is_home()) {
                                echo do_shortcode("[metaslider id=41]"); //replace 123 with slider ID
                        }
                ?>

        </div>
        <!--Site Header -->
        <nav class="site-nav">

                <?php

                $args = array(
                        'theme_location' => 'primary'
                        );
                ?>

                <?php wp_nav_menu( $args ); ?>
        
        </nav>

Thanks!



via Chebli Mohamed

Can I use Event Organiser plugin in a commercial plugin for WordPress?

Can I use this plugin in a commercial plugin for WordPress?



via Chebli Mohamed

How to Resolve unknown message digest algorithm Error in Wordpress

I am Unable to install any Plugins into my Wordpress Site, I am getting Error like:Download failed. error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm



via Chebli Mohamed

qTranslare X not trasnlating static text on frontend

I havent found an answer so i presume is something little common.

I have set up qTranlate X and lang switching works fine anf dynamic content (posts/custom posts) gets translated.

BUT static strings on frontend are not getting translated.

Im using:

<p>[:en]English Text[:es]Español[:]</p> 

and its not working as it outputs the same text ([:en]English Text[:es]Español[:])

I have tried converting the databse : qtranslate config menu > Import/export >> Convert database to the "square bracket only" style.

I have also tried other ways of doing the same but still NOT working :

<!--en-->English Text  <!--:-->  
<!--es-->Español<!--:-->

Any ideas on what is failing?

I have also used polylang and wpml on this site, well no used it really, but I have activated this plugins before and now are deleted, but didnt finish using them.



via Chebli Mohamed

Linking to a specific tab in Visual Composer

I have an issue with linking to specific tabs in Visual Composer. I have added this script to change the content to the desired tab:

jQuery(window).load(function() {
if(location.hash) {
    var panelRef = (window.location.hash.substring(1));  
        jQuery(".tab-content").each(function(index) {
        if(jQuery(this).attr("id") == panelRef) {
            jQuery("#tab-1441522486246-5-7").css("display","block");
            jQuery("#tab-1441518864-1-47").css("display","none");
        } 
      });     
    }
});

The content shows up correctly but the active tab still reverts to the first one. Is there a way where I can change it using script instead?

Here's a rough idea of what I'm trying to achieve, which I'm sure is incorrect:

jQuery(window).load(function() {
if(location.hash) {
    var panelRef = (window.location.hash.substring(1));  
        jQuery(".tab-content").each(function(index) {
        if(jQuery(this).attr("id") == panelRef) {
            jQuery("#tab-1441522486246-5-7").css("display","block");
            jQuery("#tab-1441518864-1-47").css("display","none");
        } 

        var alink = document.getElementsByTagName('li').getElementsByTagName('a').attr("href");
        var blink = document.getElementsByTagName('li').getElementsByTagName('a').attr("href");
        var first = "#tab-1441518864-1-47";
        var last = "#tab-1441522486246-5-7";

        if(alink.attr("href") == first) {
            alink.toggleClass("selected");
        }

        if(alink.attr("href") == last) {
            blink.toggleClass("selected");
        }
    });     
  }
});

Any ideas?



via Chebli Mohamed

dimanche 18 octobre 2015

How to Fix Wordpress 500 Internal server error due to custom post type

I am using couponXL theme for my site. Everything is working correct but except one ie., custom post type. In the theme , there is a plugin called CouponXL custom post type. This plugin is included to enable custom post type feature for the theme.

Whenever I activate this plugin, server is responding with 500 internal server error. When I deactivate the plugin, server is running with no issue. So the issue must be with the custom post type.

When I looked into the server error logs. I found the following error,

] [notice] EACCELERATOR(810915): PHP crashed on opline 28 of array_merge() at /home/teachpkc/public_html/offers/wp-includes/functions.php:3076
] [notice] EACCELERATOR(803175): PHP crashed on opline 28 of array_merge() at /home/teachpkc/public_html/offers/wp-includes/functions.php:3076

Here is the plugin code for the custom post type

<?php
/*
Plugin Name: Coupon XL Custom Post Types
Plugin URI: http://ift.tt/1yQzAFi
Description: Coupon XL custom post types and taxonomies
Version: 1.0
Author: pebas
Author URI: http://ift.tt/OY54ga
License: GNU General Public License version 3.0
*/

if( !function_exists( 'couponxl_post_types_and_taxonomies' ) ){
    function couponxl_post_types_and_taxonomies(){
        $offer_args = array(
            'labels' => array(
                'name' => __( 'Offers', 'couponxl' ),
                'singular_name' => __( 'Offer', 'couponxl' )
            ),
            'public' => true,
            'menu_icon' => 'dashicons-megaphone',
            'has_archive' => false,
            'supports' => array(
                'title',
                'editor',
                'thumbnail',
                'author',
                'excerpt',
                'comments'
            )
        );
        if( class_exists('ReduxFramework') && function_exists('couponxl_get_option') ){
            $trans_offer = couponxl_get_option( 'trans_offer' );
            if( !empty( $trans_offer ) ){
                $offer_args['rewrite'] = array( 'slug' => $trans_offer );
            }
        }
        register_post_type( 'offer', $offer_args ); 

        register_taxonomy( 'location', array( 'offer' ), array(
            'label' => __( 'Location', 'couponxl' ),
            'hierarchical' => true,
            'labels' => array(
                'name'                          => __( 'Location', 'couponxl' ),
                'singular_name'                 => __( 'Location', 'couponxl' ),
                'menu_name'                     => __( 'Location', 'couponxl' ),
                'all_items'                     => __( 'All Locations', 'couponxl' ),
                'edit_item'                     => __( 'Edit Location', 'couponxl' ),
                'view_item'                     => __( 'View Location', 'couponxl' ),
                'update_item'                   => __( 'Update Location', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Location', 'couponxl' ),
                'new_item_name'                 => __( 'New Location Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Location', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Location:', 'couponxl' ),
                'search_items'                  => __( 'Search Locations', 'couponxl' ),
                'popular_items'                 => __( 'Popular Locations', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate locations with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove locations', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used locations', 'couponxl' ),
                'not_found'                     => __( 'No locations found', 'couponxl' ),
            )

        ) );


        register_taxonomy( 'offer_cat', array( 'offer' ), array(
            'label' => __( 'Offer Categories', 'couponxl' ),
            'hierarchical' => true,
            'labels' => array(
                'name'                          => __( 'Offer Categories', 'couponxl' ),
                'singular_name'                 => __( 'Offer Category', 'couponxl' ),
                'menu_name'                     => __( 'Offer Category', 'couponxl' ),
                'all_items'                     => __( 'All Offer Categories', 'couponxl' ),
                'edit_item'                     => __( 'Edit Offer Category', 'couponxl' ),
                'view_item'                     => __( 'View Offer Category', 'couponxl' ),
                'update_item'                   => __( 'Update Offer Category', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Offer Category', 'couponxl' ),
                'new_item_name'                 => __( 'New Offer Category Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Offer Category', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Offer Category:', 'couponxl' ),
                'search_items'                  => __( 'Search Offer Categories', 'couponxl' ),
                'popular_items'                 => __( 'Popular Offer Categories', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate offer categories with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove offer categories', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used offer categories', 'couponxl' ),
                'not_found'                     => __( 'No offer categories found', 'couponxl' ),
            )

        ) );

        register_taxonomy( 'offer_tag', array( 'offer' ), array(
            'label' => __( 'Offer Tags', 'couponxl' ),
            'hierarchical' => false,
            'labels' => array(
                'name'                          => __( 'Offer Tags', 'couponxl' ),
                'singular_name'                 => __( 'Offer Tag', 'couponxl' ),
                'menu_name'                     => __( 'Offer Tag', 'couponxl' ),
                'all_items'                     => __( 'All Offer Tags', 'couponxl' ),
                'edit_item'                     => __( 'Edit Offer Tag', 'couponxl' ),
                'view_item'                     => __( 'View Offer Tag', 'couponxl' ),
                'update_item'                   => __( 'Update Offer Tag', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Offer Tag', 'couponxl' ),
                'new_item_name'                 => __( 'New Offer Tag Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Offer Tag', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Offer Tag:', 'couponxl' ),
                'search_items'                  => __( 'Search Offer Tags', 'couponxl' ),
                'popular_items'                 => __( 'Popular Offer Tags', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate offer tags with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove offer tags', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used offer tags', 'couponxl' ),
                'not_found'                     => __( 'No offer tags found', 'couponxl' ),
            )

        ) );

        $store_args = array(
            'labels' => array(
                'name' => __( 'Stores', 'couponxl' ),
                'singular_name' => __( 'Store', 'couponxl' )
            ),
            'public' => true,
            'menu_icon' => 'dashicons-store',
            'has_archive' => false,
            'supports' => array(
                'title',
                'editor',
                'thumbnail'
            ),
        );
        if( class_exists('ReduxFramework') && function_exists('couponxl_get_option') ){
            $trans_store = couponxl_get_option( 'trans_store' );
            if( !empty( $trans_store ) ){
                $store_args['rewrite'] = array( 'slug' => $trans_store );
            }
        }
        register_post_type( 'store', $store_args ); 

        register_taxonomy( 'letter', array( 'store' ), array(
            'label' => __( 'Letters', 'couponxl' ),
            'hierarchical' => true,
            'labels' => array(
                'name'                          => __( 'Letters', 'couponxl' ),
                'singular_name'                 => __( 'Letter', 'couponxl' ),
                'menu_name'                     => __( 'Letter', 'couponxl' ),
                'all_items'                     => __( 'All Letters', 'couponxl' ),
                'edit_item'                     => __( 'Edit Letter', 'couponxl' ),
                'view_item'                     => __( 'View Letter', 'couponxl' ),
                'update_item'                   => __( 'Update Letter', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Letter', 'couponxl' ),
                'new_item_name'                 => __( 'New Letter Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Letter', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Letter:', 'couponxl' ),
                'search_items'                  => __( 'Search Letters', 'couponxl' ),
                'popular_items'                 => __( 'Popular Letters', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate letters with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove letters', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used letters', 'couponxl' ),
                'not_found'                     => __( 'No letters found', 'couponxl' ),
            )

        ) );        

        register_post_type( 'voucher', array(
            'labels' => array(
                'name' => __( 'Vouchers', 'couponxl' ),
                'singular_name' => __( 'Voucher', 'couponxl' )
            ),
            'public' => true,
            'menu_icon' => 'dashicons-tickets-alt',
            'has_archive' => false,
            'supports' => array(
                'title',
            ),
            'capabilities' => array(
                'publish_posts' => 'manage_options',
                'edit_posts' => 'manage_options',
                'edit_others_posts' => 'manage_options',
                'delete_posts' => 'manage_options',
                'delete_others_posts' => 'manage_options',
                'read_private_posts' => 'manage_options',
                'edit_post' => 'manage_options',
                'delete_post' => 'manage_options',
                'read_post' => 'manage_options',
            ),          
        ));

        if( class_exists( 'Seravo_Custom_Bulk_Action' ) ){
            $bulk_actions = new Seravo_Custom_Bulk_Action( array('post_type' => 'voucher') );

            $bulk_actions->register_bulk_action(array(
                'menu_text' => __( 'Pay To Sellers', 'couponxl' ),
                'admin_notice'=> __( 'Sellers are paid', 'couponxl' ),
                'callback' => function( $post_ids ) {
                    couponxl_pay_all_sellers( $post_ids, 'no' );
                    return true;
                }
            ));

            $bulk_actions->init();
        }

    }
}
add_action('init', 'couponxl_post_types_and_taxonomies', 0);

?>

I have tried all solutions in the net but couldn't solve :( Could you please help me, what is the error and how to fix it :)

Note: I am using this theme in a sub-domain. Don't know whether the problem could be because of this. To your information guys I've added



via Chebli Mohamed

Set Redux sorter field option values programatically

I'm working on a section sorter plugin, for that I used Redux to set a simple options page with only the sorter field. The thing is, I can't put the enabled values programatically, I have tried several ways and nothing seems to work.

I am using AJAX to get the ids of all section tags in homepage, then, I send the sections' ids to a function in the options file (Redux options file, sample-config.php, or in my case sorting-sections-options.php , like this:

This is my JS/JQ/AJAX code:

jQuery(document).ready(function($){
var sections_ids = {action: 'save_sections_ids'};
$.get(window.location.protocol + "//" + window.location.host + "/futbol-americano", function(data) {
var sections_elements = $(data).find("section");
sections_elements.each(function(){
var section_id = $(this).attr("id");

sections_ids[section_id] = section_id; 
console.log(section_id);

}); 
pass_ids_to_server(sections_ids);

});

function pass_ids_to_server(sections_ids){
    $.ajax({
        url : sorting_sections.ajax_url,
        type : 'post',
        data : sections_ids,
        success : function( response ) {             
            alert(response);
        }
    }); 
} 
});

This is the function that receives the data from ajax:

This is the form is has currently, but I have tried looping the $_POST variable and returning an array to place inside the 'enabled' => $array and several other ways, so I though the asinchronous call could be doing that the field load before the function and decided to store the data in user meta.

add_action( 'wp_ajax_save_sections_ids', 'save_sections_ids_sorting_sections' );

function save_sections_ids_sorting_sections() {

$user_id = get_current_user_id();
update_user_meta($user_id, "set-sections", $_POST);

}

The AJAX call works, and the function that receives the data works as well. The data stores in the user_meta table in database. But when I do this:

$user_id = get_current_user_id();
$get_sections_array = get_user_meta($user_id, "set-sections", true);
//Returns false but if var_dumped inside the save_sections_ids_sorting_sections() function, it shows the array correctly in an alert box (from succes on ajax call).

$sorter_field = array(
'section_id' => 'basic',
'id' => 'opt-homepage-layout-3',
'type' => 'sorter',
'title' => 'Este es el titulo',
'desc' => 'this is the description',
'compiler' => 'true',
'options' => array(
'disabled' => array(
),
'enabled' => $get_sections_array;
));

Redux::setField($opt_name, $sorter_field );
//The Redux::setField($opt_name, $sorter_field ); works if I define $sorter_field manually before the instance.

I get the following error message in the options page:

Warning: array_merge(): Argument #2 is not an array in C:\xampp\htdocs\futbol-americano\wp-content\plugins\sorting-sections\ReduxFramework\ReduxCore\inc\fields\sorter\field_sorter.php on line 81

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\futbol-americano\wp-content\plugins\sorting-sections\ReduxFramework\ReduxCore\inc\fields\sorter\field_sorter.php on line 103

I hope someone can help with this.

Thanks in advance.



via Chebli Mohamed

Display body text from custom post

I'm using PODS to create custom post types. I want to display these post types in my custom template. I've been able to display the title, image, but haven't found a way to display body content yet. I have tried get_the_content( $id ) without luck. Any ideas?

<?php

            $pod = pods( 'selectoffers' );
            $related = $pod->field( 'select' );

            if ( ! empty( $related ) ) {
                foreach ( $related as $rel ) {

                    $id = $rel[ 'ID' ];

                    ?>

                    <div class="col-lg-4">
                    <div class="round-img img-circle" style="background-image:url('<?php echo pods_image_url(get_post_meta( $id, 'bilde', true ), $size = 'full'); ?>');"></div>
                              <h2><?php echo get_the_title( $id ); ?></h2>

                              <p>   [[THIS IS WHERE I WANT TO ADD THE BODY]]   </p>

                              <p><a class="btn btn-default" href="<?php
                                                                 $lenke = get_post_meta( $id, 'lenke', true );
                                                                 echo esc_url( get_permalink( array_shift($lenke) ) );
                                                                 ?>" role="button">Les mer &raquo;</a></p>
        </div><!-- /.col-lg-4 -->



                    <?php

                } //end of foreach
            } //endif ! empty ( $related )
?>



via Chebli Mohamed