Affichage des articles dont le libellé est Newest questions tagged wordpress-plugin - Stack Overflow. Afficher tous les articles
Affichage des articles dont le libellé est Newest questions tagged wordpress-plugin - Stack Overflow. Afficher tous les articles

lundi 5 octobre 2015

Want to use pick-up and delivery date/time widget in wordpress site

I have a shopping cart setup on my website using woocommerce and all is set up perfectly What i want to achive there is to create a custom radio buttons to select the option for delivery/pickup. Is there any plugin which I can use to achieve the same? Can someone please help. Please note I am new to Wordpress and learning by online videos and ebooks.



via Chebli Mohamed

Make images private in Wordpress

I'm making a site, that I would like to make private. The most important part, is that the images on the domain can't be seen, without the user logging in first. So I would like all traffic to be redirected to http://ift.tt/1RrbBBI (also for images), if the user isn't logged in.

Here's what I've tried:

1) Plugins. I've tried both Wordpress Force Login , the plugin wp-require-login and a Coming soon page and Maintenance mode.

2) Adding a function from this answer. Which is this:

function is_login_page() {
    return in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) );
}

function wpse_make_blog_private() {
    if ( ! is_user_logged_in() && ! is_admin() && ! is_login_page() ) { 
    global $wp_query;
    $wp_query->set_404();
    }
}
add_action( 'wp', 'wpse_make_blog_private' );

Non of these things redirects the traffic, if I go to the direct URL for the image (such as http://ift.tt/1Nh1z7r ).

Can that be done?

----------------- EDIT 1 --------------

Mevius pointed out, that Wordpress might not be loaded, if you type in the direct URL to an image, so he suggests, that it should be done on apache-level.

------------- END OF EDIT 1 -----------



via Chebli Mohamed

Getting error in an woocommerce based store. WP is not defined in meta boxes variations.php

I have a woocommerce based online store with around 70 products. Everything was working fine till yesterday, today I am getting these javascript errors

  1. WP is not defined in meta boxes variations.php in product list page. (causing the list of products is not displaying in backend. Its there in db I checked.)

  2. woocommerce_params not defined.(Causing plugin list not displaying but that is solved for now.)

No theme up-gradation, no woocommerce up-gradation not even wordpress. Nothing is happened.

Can anybody tell what might be the issue? I have WordPress 4.0.8 and woocommerce 2.3

Thanks in advance.



via Chebli Mohamed

Make code snippet into a foreach loop

I have a piece of code which is used to replace double dashes for commas in a wordpress taxonomy called “authors” before displaying values to the end user.

This is working great, but now I need to apply it to several different taxonomies, no just “authors” but also “printers”, “translators”, etc.

My idea was to build an array of taxonomies instead of a single variable and then use a foreach loop to apply the find and replace to each of them, but no matter how I try it I can’t seem to make it work…

Any idea how to make the following code into a foreach loop if $custom_taxonomy_type was an array?

This is the code that is currently working for a single taxonomy.

if(!is_admin()){ // make sure the filters are only called in the frontend

$custom_taxonomy_type = 'authors';  // here goes your taxonomy type

function comma_taxonomy_filter($tag_arr){
    global $custom_taxonomy_type;
    $tag_arr_new = $tag_arr;
    if($tag_arr->taxonomy == $custom_taxonomy_type && strpos($tag_arr->name, '--')){
        $tag_arr_new->name = str_replace('--',', ',$tag_arr->name);
    }
    return $tag_arr_new;    
}
add_filter('get_authors', comma_taxonomy_filter);

function comma_taxonomies_filter($tags_arr){
    $tags_arr_new = array();
    foreach($tags_arr as $tag_arr){
        $tags_arr_new[] = comma_taxonomy_filter($tag_arr);
    }
    return $tags_arr_new;
}
add_filter('get_the_taxonomies',    comma_taxonomies_filter);
add_filter('get_terms',             comma_taxonomies_filter);
add_filter('get_the_terms',         comma_taxonomies_filter);

}

As requested by @Epodax here are the two things I've tried so far. Both result in a blank page:

if(!is_admin()){ // make sure the filters are only called in the frontend

    $custom_taxonomy_type_array = array('authors', 'printer');  // here goes your taxonomy type

    foreach ($custom_taxonomy_type_array as $custom_taxonomy_type) {
        function comma_taxonomy_filter($tag_arr){
            global $custom_taxonomy_type;
            $tag_arr_new = $tag_arr;
            if($tag_arr->taxonomy == $custom_taxonomy_type && strpos($tag_arr->name, '--')){
                $tag_arr_new->name = str_replace('--',', ',$tag_arr->name);
            }
            return $tag_arr_new;    
        }
        add_filter('get_'.$custom_taxonomy_type, comma_taxonomy_filter);

        function comma_taxonomies_filter($tags_arr){
            $tags_arr_new = array();
            foreach($tags_arr as $tag_arr){
                $tags_arr_new[] = comma_taxonomy_filter($tag_arr);
            }
            return $tags_arr_new;
        }
        add_filter('get_the_taxonomies',    comma_taxonomies_filter);
        add_filter('get_terms',             comma_taxonomies_filter);
        add_filter('get_the_terms',         comma_taxonomies_filter);
    }


}

and

if(!is_admin()){ // make sure the filters are only called in the frontend

    $custom_taxonomy_type_array = array('authors', 'printer');  // here goes your taxonomy type

    function comma_taxonomy_filter($tag_arr){
        foreach ($custom_taxonomy_type_array as $custom_taxonomy_type) {
            global $custom_taxonomy_type;
            $tag_arr_new = $tag_arr;
            if($tag_arr->taxonomy == $custom_taxonomy_type && strpos($tag_arr->name, '--')){
                $tag_arr_new->name = str_replace('--',', ',$tag_arr->name);
            }
            return $tag_arr_new;    
        }
    }
    foreach ($custom_taxonomy_type_array as $custom_taxonomy_type) {
        add_filter('get_'.$custom_taxonomy_type, comma_taxonomy_filter);
    }

    function comma_taxonomies_filter($tags_arr){
        foreach ($custom_taxonomy_type_array as $custom_taxonomy_type) {
            $tags_arr_new = array();
            foreach($tags_arr as $tag_arr){
                $tags_arr_new[] = comma_taxonomy_filter($tag_arr);
            }
            return $tags_arr_new;
        }
    }
    foreach ($custom_taxonomy_type_array as $custom_taxonomy_type) {
        add_filter('get_the_taxonomies',    comma_taxonomies_filter);
        add_filter('get_terms',             comma_taxonomies_filter);
        add_filter('get_the_terms',         comma_taxonomies_filter);
    }

}



via Chebli Mohamed

Add back-end WP plugin to front-end template

I just need to be pointed the right direction here, I don't expect the exact answer.

Basically, I got a wordpress plugin for woocommerce. It adds a new metabox with options to choose from within the 'add new product' area in admin back-end.

Plugin here http://ift.tt/1FY4Wfa

My theme with other plugins allow me to add new products from the front-end and so I would like to use this plugin also from the front-end.

So how can I bring the plugin to my theme template to be able to choose its option from the front-end? Or what steps to take that I could google some tutorials and take it from there?

I haven't tried anything just yet, I just have no idea where to start.

Any help is appreciated



via Chebli Mohamed

dimanche 4 octobre 2015

How to use diferent template for bbpress in wordpress?

I want to develop a forum in bbpress. The problem I am getting now is I don't know how to use different templates file for bbpress. I want totaly different look for my forum from WordPress main blog. Like I want to show different logo and menu bar on my forum.

How to do it? I tried creating template file like this:

Functions.php

function register_my_menus() {
        register_nav_menu( 'lcs', __( 'LCS Menu') );
        register_nav_menu( 'lcsi', __( 'LCSi Menu' ) );
    }
    add_action( 'init', 'register_my_menus' );

Templ.php

<?php
/**
 * This file adds a custom template to the Genesis Theme.
 *
 * @author Author
 * @link http://mywebsite.com/
 * @package 
 * @subpackage Customizations
 */

/*
Template Name: Full Width Template
*/

$args = array();
if (is_bbpress() ) $args['theme_location'] = 'forumsmenu';
else $args['theme_location'] = 'secforum';
wp_nav_menu($args);

// Add custom body class to the head
add_filter( 'body_class', 'add_body_class' );
function add_body_class( $classes ) {
   $classes[] = 'agentpress-custom';
   return $classes;
}

// Force full width page layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

genesis();

?>

This code is working for the pages but not for bbpress. So my question is

  1. How to use different template file for bbpress in WordPress?
  2. Is there any way to give totally different look to bbpress? e.g. Changing logo and footer

I don't want to use different WordPress installation or database.



via Chebli Mohamed