lundi 19 octobre 2015

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