dimanche 24 avril 2016

Users/cookies across multiple Wordpress installs

I've found some useful information on this subject, but haven't found any solutions that works. I have new installs of wordpress 4.5 on all sites. I want to set up multiple Wordpress Multisite installs and share the same user database as well as cookies so users are signed in as they move from site to site.

Sharing the database tables is easy. However, sharing login status via shared cookies hasn't worked.

I've tried every variation of

define('COOKIE_DOMAIN', '.domain.com');
define('COOKIEPATH', '/'); 
define( 'SITECOOKIEPATH', '/'); 

and a few other and still no go.

Here's what I would like to accomplish: I need to set up a solution where users are shared across several subdomains. The reason for multiple Multisite installs is that each Multisite has a different purpose and requires the ability to set up segregated sites. We still need to use the same main members list and keep members logged in across all the sections. For example, a clubs site at clubs.domain.com where each club has its own site under http://ift.tt/1Nr6cwU. Another subdomains (members.domain.com) will offer the ability for regular members to create pages at http://ift.tt/1SDs07u. Everything about this is easy except keeping members logged in as they move from subdomain to subdomain. Shared user database is easy (more or less), but reporting the login status via cookies hasn't worked.

Any insight is appreciated.



via Chebli Mohamed

Change the website default Language (Wordpress)

In wordpress when I change the default site language to be Italian, my admin panel changed to Italian as well , How I can set two default languages one for the website visitors and the other for the admin panel?



via Chebli Mohamed

Restrict shop manager from woocommerce checkout settings tab

How can I restrict users with a certain role(shop manager) from accessing selected woocommerce settings tabs. I asked a similar question here, but the answer will only hide the tab from showing up but will not restrict the user from the page if he types the url directly.

I can't seem to figure this out.



via Chebli Mohamed

Wordpress JetPack is not working how to solve it?

My wordpress blog Jetpack is not working its says that error in load.php file and when i solve it my wordpress dashboard start showing blank screen my blog url is http://trickytrick.in/



via Chebli Mohamed

samedi 23 avril 2016

Creating custom Wordpress object

I'm putting together my own Wordpress theme for a very specific set of client requirements. I'm fine with front-end theme work, but I need some help with back end.

The task is kind of like a support site, with lots of Q and A's. I'm building a support site for a company, which means most Pages will be populated with many questions and associated answers.

The page Structure would be something like this:

Home Page (with links to Most recent Q+As added) and common sections
-How to use the app (10-20 Q+As on page)
-How to manage integrations (10-20 Q+As on page)
-Other page (10-20 Q+As on page)
-5-10x 'Other pages'
About Us
Contact Support

Requirements and my comments

-Each Q and A does not have it's own URL
This makes using Posts for Q and A's unattractive.

-Each Page is made up of a Table of Contents which allows quick scrolling to questions
An ideal solution would be some code on the page theme template which grabs each "Q and A" object within a certain category/section/identifier and load it to the page

-New questions and answers can quickly and easily be added
The ideal solution for support reps is that they can add a question and answer, and assign a category, rather than edit a huge page of questions.

-Order of Q and A's on page is important
Ideal solution should allow you to order the Q+As within their given category/section/other.

-On the home page, most recent Q+As added list exists

-Each Page of Q+As has a "last updated" date, which is the date the most recent Q+A was most recently modified.


Ideas I had

Posts or custom posts seemed like a good idea, but they create permalinks. But my "Pages" would actually be Category Archive pages. We don't want a Q+A to be be assigned two categories. Also, custom post ordering seems difficult. If we could suppress permalinks and ensure on category or section and find a way to order them - this could work.

FAQ Plugins

It seems like these all are a bit clunky and the amount of custom dev to re-skin on it might not be worth it, might be easier to do something totally custom.

Question:
does anyone have any ideas how this could be achieved?



via Chebli Mohamed

Wonder Plugin Carousel not showing up in my custom theme

I am having a problem getting the Wonder Plugin to show up on my cutom theme. This is the first plugin I have used where I have had any issues when I test it in twentyfifteen theme it works fine. I don't even get an error which makes the problem even more difficult to solve. I am not sure if I am missing some code to get my plugins to work.

Here is my functions.php:

    <?php


     /*



* @package WordPress
 * @subpackage Creativeforces
 * @since Creativeforces 1.0
 */ 

?>





<?php 

require_once('wp_bootstrap_navwalker.php');


    // Make theme available for translation
// Translations can be filed in the /languages/ directory
load_theme_textdomain( 'creativeforces', TEMPLATEPATH . '/languages' );

$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable($locale_file) )
    require_once($locale_file);

// Get the page number
function get_page_number() {
    if ( get_query_var('paged') ) {
        print ' | ' . __( 'Page ' , 'creativeforces') . get_query_var('paged');
    }
} // end get_page_number


function register_my_menus() {
  register_nav_menus(
    array(
       'primary' => __( 'Primary Menu', 'Creativeforces' ),
      'header-menu' => __( 'Header Menu' ),
      'extra-menu' => __( 'Extra Menu' ),
      'sub_menu' => true
    )
  );
}

add_action( 'init', 'register_my_menus' );

   $defaults = array(
    'default-image'          => '',
    'width'                  => 0,
    'height'                 => 0,
    'flex-height'            => false,
    'flex-width'             => false,
    'uploads'                => false,
    'random-default'         => false,
    'header-text'            => true,
    'default-text-color'     => '',
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $defaults );



function themeslug_theme_customizer( $wp_customize ) {

  $wp_customize->add_section( 'themeslug_logo_section' , array(
    'title'       => __( 'Logo', 'themeslug' ),
    'priority'    => 30,
    'description' => 'Upload a logo to replace the default site name and description in the header',
) );
  $wp_customize->add_setting( 'themeslug_logo' );

  $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
    'label'    => __( 'Logo', 'themeslug' ),
    'section'  => 'themeslug_logo_section',
    'settings' => 'themeslug_logo',
) ) );
    // Fun code will go here
}
add_action( 'customize_register', 'themeslug_theme_customizer' );

 add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag


function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
  if ( isset( $args->sub_menu ) ) {
    $root_id = 0;

    // find the current menu item
    foreach ( $sorted_menu_items as $menu_item ) {
      if ( $menu_item->current ) {
        // set the root id based on whether the current menu item has a parent or not
        $root_id = ( $menu_item->menu_item_parent ) ? $menu_item->menu_item_parent : $menu_item->ID;
        break;
      }
    }

    // find the top level parent
    if ( ! isset( $args->direct_parent ) ) {
      $prev_root_id = $root_id;
      while ( $prev_root_id != 0 ) {
        foreach ( $sorted_menu_items as $menu_item ) {
          if ( $menu_item->ID == $prev_root_id ) {
            $prev_root_id = $menu_item->menu_item_parent;
            // don't set the root_id to 0 if we've reached the top of the menu
            if ( $prev_root_id != 0 ) $root_id = $menu_item->menu_item_parent;
            break;
          } 
        }
      }
    }
    $menu_item_parents = array();
    foreach ( $sorted_menu_items as $key => $item ) {
      // init menu_item_parents
      if ( $item->ID == $root_id ) $menu_item_parents[] = $item->ID;
      if ( in_array( $item->menu_item_parent, $menu_item_parents ) ) {
        // part of sub-tree: keep!
        $menu_item_parents[] = $item->ID;
      } else if ( ! ( isset( $args->show_parent ) && in_array( $item->ID, $menu_item_parents ) ) ) {
        // not part of sub-tree: away with it!
        unset( $sorted_menu_items[$key] );
      }
    }

    return $sorted_menu_items;
  } else {
    return $sorted_menu_items;
  }
}

/**
 * Register our sidebars and widgetized areas.
 *
 */
function arphabet_widgets_init() {

  register_sidebar( array(
    'name'          => 'Primary Sidebar',
    'id'            => 'home_right_1',
    'before_widget' => '<div>',
    'after_widget'  => '</div>',
    'before_title'  => '<h2 class="rounded">',
    'after_title'   => '</h2>',
  ) );

}
add_action( 'widgets_init', 'arphabet_widgets_init' );





?>

here is my media.php I am adding the shortcode in:

<h3 class="text-center article-head">Check out the article that was written about us!</h3>
<div class="text-center">
   <img src="/wp-content/themes/creativeforces/images/la-parent.jpg" alt="" />
   </div>
   <h3 class="text-center"><a href="http://ift.tt/22Wscl6" target="_blank">Theater Improv Games are Fun Ideas For Kids</a></h3>
 <?php echo do_shortcode('[wonderplugin_carousel id="1"]'); ?>

I will be adding it to the Wordpress backend later. This is simply for testing purposes. Any help would be appreciated!



via Chebli Mohamed

Change Buddy-Verified plugin in BuddyPress to show Text as Title

I'm using BuddyPress to design my own social networking site and I've just added the BuddyVerified plugin and I just used a code that a forum user solved the problem of moving the verified badge from the profile pic (view forum here)

I'm happy with the result, however the verified text is placed at the bottom there instead of being used as a title. I want the verified badge to be used as a title, so when I hover over the badge it will display the verified text.

The PHP code I'm using for the Verified Badge is here



via Chebli Mohamed