samedi 23 avril 2016

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

Aucun commentaire:

Enregistrer un commentaire