Forum Replies Created

Viewing 15 replies - 1 through 15 (of 26 total)
  • Thread Starter supeherotim

    (@supeherotim)

    @oaoyadeyi Hi, thanks for the reply. Sorry, I shoul’ve specified that we already have this extension setup and it hasn’t fixed the problem unfortuntely.

    Thanks for the suggestion though

    Thread Starter supeherotim

    (@supeherotim)

    Thanks so much for that! It’s fixed my problem.

    Thread Starter supeherotim

    (@supeherotim)

    Thanks for the help. It’s working now! Is there a way to replace category_name with a custom taxonomy name?

    I would make a category.php page, but I want to add other content using the page editor to the pages and I don’t want category in the url either.

    Thread Starter supeherotim

    (@supeherotim)

    Since the category slug will be the same as the pages slug I’m trying to set the category_name as the current pages slug.

    Thread Starter supeherotim

    (@supeherotim)

    Thanks for the reply. I’ve managed to fix it now. Just missing a closing style tag in my custom-header file.

    Thread Starter supeherotim

    (@supeherotim)

    So Underscores?

    Thread Starter supeherotim

    (@supeherotim)

    There is no reason to pinch it, but on almost every responsive site I’ve seen the screen resets after it,a been pinched. It doesn’t break like that.

    Thread Starter supeherotim

    (@supeherotim)

    Here’s what happens once the screen resets after I pinch it.

    Thread Starter supeherotim

    (@supeherotim)

    Well for me when you make it the width of an average smart phone the white background is pushed to the left and everything gets smaller.

    On a mobile if you pinch the screen to zoom out you don’t reset to a responsive look.

    Thread Starter supeherotim

    (@supeherotim)

    Hi, thanks for all the help guys. I’ve definitely learnt a load more about theme development now.

    Thread Starter supeherotim

    (@supeherotim)

    Sorry about that. Next time I’ll be sure to use pastebin or something.

    There is an error in the customizer.js file according to the browser console. The problem is that I don’t know how to fix it.

    The error message is ‘Uncaught SyntaxError: missing ) after argument list’

    Any help is appreciated.

    Thread Starter supeherotim

    (@supeherotim)

    Thanks for the reply. I’ve just set each element up individually. Now my live preview isn’t working in the customizer?

    Here is the code for my customizer.php, customizer.js and functions.php (The background color is the only thing that the live preview works for)

    <?php
    /**
     * Elesha Theme Customizer
     *
     * @package Elesha
     */
    
    /**
     * Add postMessage support for site title and description for the Theme Customizer.
     *
     * @param WP_Customize_Manager $wp_customize Theme Customizer object.
     */
    function elesha_customize_register( $wp_customize ) {
    
    	$wp_customize->add_setting( 'header_textcolor' , array(
    		'default'     => '#000',
    		'transport' => 'postMessage',
    ) );
    
    	$wp_customize->add_setting( 'link_hover_color' , array(
        'default'     => '#32373c',
        'transport'   => 'postMessage',
    ) );
    
    $wp_customize->add_setting( 'link_color' , array(
    	'default'     => '#989b9d',
    	'transport'   => 'postMessage',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_textcolor', array(
    	'label'        => 'Site Header Text Color',
    	'section'    => 'header_colors',
    	'settings'   => 'header_textcolor',
    ) ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_hover_color', array(
    	'label'        => 'Page Links Hover Color',
    	'section'    => 'header_colors',
    	'settings'   => 'link_hover_color',
    ) ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
    	'label'        => 'Page Links Colors',
    	'section'    => 'colors',
    	'settings'   => 'link_color',
    ) ) );
    
    $wp_customize->add_setting( 'text_color' , array(
    	'default'     => '#404040',
    	'transport'   => 'postMessage',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'text_color', array(
    	'label'        => 'Text Color',
    	'section'    => 'colors',
    	'settings'   => 'text_color',
    ) ) );
    
    $wp_customize->add_setting( 'header_color' , array(
    	'default'     => '#404040',
    	'transport'   => 'postMessage',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_color', array(
    	'label'        => 'Header Tag Color',
    	'section'    => 'colors',
    	'settings'   => 'header_color',
    ) ) );
    
    $wp_customize->add_setting( 'primary_color' , array(
    	'default'     => '#32373c',
    	'transport'   => 'postMessage',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array(
    	'label'        => 'Primary Color',
    	'section'    => 'header_colors',
    	'settings'   => 'primary_color',
    ) ) );
    
    $wp_customize->add_setting( 'secondary_color' , array(
    	'default'     => '#eaeaea',
    	'transport'   => 'postMessage',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'secondary_color', array(
    	'label'        => 'Secondary Color',
    	'section'    => 'header_colors',
    	'settings'   => 'secondary_color',
    ) ) );
    
    $wp_customize->add_section('header_colors', array(
            'title'    => __('Header Colors', 'elesha'),
            'description' => '',
            'priority' => 70,
    ));
    
    $wp_customize->add_setting('site_header_bg', array(
    	'default'     => '#fff',
    	'transport'   => 'postMessage',
    ));
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'site_header_bg', array(
    		'label'      => __('Site Header Background', 'elesha'),
    		'section'    => 'header_colors',
    		'settings'   => 'site_header_bg',
    )));
    
    }
    
    add_action( 'customize_register', 'elesha_customize_register' );
    
    /**
     * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
     */
    function elesha_customize_preview_js() {
    	wp_enqueue_script( 'elesha_customizer', get_template_directory_uri() . '/js/customizer.js',
    	array( 'customize-preview' ), '20151215', true );
    }
    add_action( 'customize_preview_init', 'elesha_customize_preview_js' );
    /**
     * File customizer.js.
     *
     * Theme Customizer enhancements for a better user experience.
     *
     * Contains handlers to make Theme Customizer preview reload changes asynchronously.
     */
    
    ( function( $ ) {
    
    	// Site title and description.
    	wp.customize( 'site-title', function( value ) {
    		value.bind( function( to ) {
    			$( '.site-title a' ).text( to );
    		} );
    	} );
    	wp.customize( 'site-description', function( value ) {
    		value.bind( function( to ) {
    			$( '.site-description' ).text( to );
    		} );
    	} );
    
    	// Header text color.
    	wp.customize( 'header_textcolor', function( value ) {
    		value.bind( function( to ) {
    			if ( 'blank' === to ) {
    				$( '.site-title a, .site-description' ).css( {
    					'clip': 'rect(1px, 1px, 1px, 1px)',
    					'position': 'absolute'
    				} );
    			} else {
    				$( '.site-title a, .site-description' ).css( {
    					'clip': 'auto',
    					'position': 'relative'
    				} );
    				$( '.site-title a, .site-description' ).css( {
    					'color': to
    				} );
    			}
    		} );
    	} );
    
    	wp.customize( 'link_color', function( value ) {
        value.bind( function( newval ) {
          $( '.widget a' ).css( 'color', newval );
        } );
      } );
    
    	wp.customize( 'link_hover_color', function( value ) {
        value.bind( function( newval ) {
          $( '.site-content a:hover a:visited a:focus, .site-content a:hover a:visited a:focus' ).css( 'color', newval );
        } );
      } );
    
      wp.customize( 'text_color', function( value ) {
        value.bind( function( newval ) {
          $( 'p' ).css( 'color', newval );
        } );
      } );
    
    	wp.customize( 'header_color', function( value ) {
        value.bind( function( newval ) {
          $( 'h1, h2, h3, h4, h5, h6' ).css( 'color', newval );
        } );
      } );
    
    	wp.customize( 'site_header_bg', function( value ) {
        value.bind( function( newval ) {
          $( 'header .site-header' ).css( 'background', newval );
        } );
      } );
    
    	wp.customize( 'primary_color', function( value ) {
        value.bind( function( newval ) {
          $( 'button, input[type="submit"], button .current-menu-item, .nav-menu .current_page_item' ).css( 'background', 'border-color' newval );
    			$( '.widget_archive ul li, .widget_nav_menu ul li, .widget_categories ul li, .widget_meta ul li, .widget_recent_entries ul li, .widget_rss ul li, .widget_recent_comments ul li, .tagcloud a, .tags-links a, .cat-links a' ).css( 'border-color' newval );
        } );
      } );
    
    	wp.customize( 'secondary_color', function( value ) {
        value.bind( function( newval ) {
          $( '.button, input[type="submit"], button .current-menu-item, .nav-menu .current_page_item, .widget_archive ul li, .widget_nav_menu ul li, .widget_categories ul li, .widget_meta ul li, .widget_recent_entries ul li, .widget_rss ul li, .widget_recent_comments ul li, .tagcloud a, .tags-links a, .cat-links a' ).css( 'background', 'border-color' newval );
        } );
      } );
    
    } )( jQuery );
    <?php
    /**
     * Elesha functions and definitions
     *
     * @link https://developer.www.ads-software.com/themes/basics/theme-functions/
     *
     * @package Elesha
     */
    
    if ( ! function_exists( 'elesha_setup' ) ) :
    /**
     * Sets up theme defaults and registers support for various WordPress features.
     *
     * Note that this function is hooked into the after_setup_theme hook, which
     * runs before the init hook. The init hook is too late for some features, such
     * as indicating support for post thumbnails.
     */
    function elesha_setup() {
    	/*
    	 * Make theme available for translation.
    	 * Translations can be filed in the /languages/ directory.
    	 * If you're building a theme based on Elesha, use a find and replace
    	 * to change 'elesha' to the name of your theme in all the template files.
    	 */
    	load_theme_textdomain( 'elesha', get_template_directory() . '/languages' );
    
    	// Add default posts and comments RSS feed links to head.
    	add_theme_support( 'automatic-feed-links' );
    
    	/*
    	 * Let WordPress manage the document title.
    	 * By adding theme support, we declare that this theme does not use a
    	 * hard-coded <title> tag in the document head, and expect WordPress to
    	 * provide it for us.
    	 */
    	add_theme_support( 'title-tag' );
    
    	/*
    	 * Enable support for Post Thumbnails on posts and pages.
    	 *
    	 * @link https://developer.www.ads-software.com/themes/functionality/featured-images-post-thumbnails/
    	 */
    	add_theme_support( 'post-thumbnails' );
    
    	add_theme_support( 'custom-logo', array(
    		'height'      => 100,
    		'flex-width' => true,
    	) );
    
    	// This theme uses wp_nav_menu() in one location.
    	register_nav_menus( array(
    		'menu-1' => esc_html__( 'Primary', 'elesha' ),
    	) );
    
    	/*
    	 * Switch default core markup for search form, comment form, and comments
    	 * to output valid HTML5.
    	 */
    	add_theme_support( 'html5', array(
    		'search-form',
    		'comment-form',
    		'comment-list',
    		'gallery',
    		'caption',
    	) );
    
    	// Set up the WordPress core custom background feature.
    	add_theme_support( 'custom-background', apply_filters( 'elesha_custom_background_args', array(
    		'default-color' => 'ffffff',
    		'default-image' => '',
    	) ) );
    
    	// Add theme support for selective refresh for widgets.
    	add_theme_support( 'customize-selective-refresh-widgets' );
    }
    endif;
    add_action( 'after_setup_theme', 'elesha_setup' );
    
    /**
     * Set the content width in pixels, based on the theme's design and stylesheet.
     *
     * Priority 0 to make it available to lower priority callbacks.
     *
     * @global int $content_width
     */
    function elesha_content_width() {
    	$GLOBALS['content_width'] = apply_filters( 'elesha_content_width', 640 );
    }
    add_action( 'after_setup_theme', 'elesha_content_width', 0 );
    
    /**
     * Register widget area.
     *
     * @link https://developer.www.ads-software.com/themes/functionality/sidebars/#registering-a-sidebar
     */
    function elesha_widgets_init() {
    	register_sidebar( array(
    		'name'          => esc_html__( 'Sidebar', 'elesha' ),
    		'id'            => 'sidebar-1',
    		'description'   => esc_html__( 'Add widgets here.', 'elesha' ),
    		'before_widget' => '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</section>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    
    	register_sidebar( array(
    		'name' => 'Footer Section 1',
    		'id' => 'footer-section-1',
    		'description' => 'Appears in the footer area',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    	register_sidebar( array(
    		'name' => 'Footer Section 2',
    		'id' => 'footer-section-2',
    		'description' => 'Appears in the footer area',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    	register_sidebar( array(
    		'name' => 'Footer Section 3',
    		'id' => 'footer-section-3',
    		'description' => 'Appears in the footer area',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    	register_sidebar( array(
    		'name' => 'Footer Section 4',
    		'id' => 'footer-section-4',
    		'description' => 'Appears in the footer area',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    }
    
    add_action( 'widgets_init', 'elesha_widgets_init' );
    
    /**
     * Enqueue scripts and styles.
     */
    function elesha_scripts() {
    	wp_enqueue_style( 'elesha-style', get_stylesheet_uri() );
    
    	wp_enqueue_style( 'elesha-sidebar-style', '/wp-content/themes/elesha/layouts/content-sidebar.css');
    
    	wp_enqueue_script( 'elesha-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
    
    	wp_enqueue_script( 'elesha-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
    
    	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    		wp_enqueue_script( 'comment-reply' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'elesha_scripts' );
    
    /**
     * Implement the Custom Header feature.
     */
    require get_template_directory() . '/inc/custom-header.php';
    
    /**
     * Custom template tags for this theme.
     */
    require get_template_directory() . '/inc/template-tags.php';
    
    /**
     * Custom functions that act independently of the theme templates.
     */
    require get_template_directory() . '/inc/extras.php';
    
    /**
     * Customizer additions.
     */
    require get_template_directory() . '/inc/customizer.php';
    
    /**
     * Load Jetpack compatibility file.
     */
    require get_template_directory() . '/inc/jetpack.php';
    
    add_action( 'wp_head', 'elesha_customizer_css');
    function elesha_customizer_css()
    {
        ?>
             <style type="text/css">
                .site-content a { color: <?php echo get_theme_mod('link_color', '#989b9d'); ?>; }
             </style>
    				 <style type="text/css">
    
    				 .site-content a:hover, a:visited, a:focus, .site-content a:hover, a:visited, a:focus  {
    					 color: <?php echo get_theme_mod('link_hover_color', '#32373c'); ?>;
    				 }
     </style>
    				 <style type="text/css">
                 p { color: <?php echo get_theme_mod('text_color', '#404040'); ?>; }
             </style>
    
    				 <style type="text/css">
                 h1, h2, h3, h4, h5, h6 { color: <?php echo get_theme_mod('header_color', '#404040'); ?>; }
             </style>
    
    				 <style type="text/css">
    				 		  header .site-header { background: <?php echo get_theme_mod('site_header_bg', '#fff'); ?>; }
             </style>
    
    				 <style type="text/css">
    				 		  button, input[type="submit"], button .current-menu-item, .nav-menu .current_page_item  {
    								background: <?php echo get_theme_mod('primary_color', '#32373c'); ?>;
    								border-color: <?php echo get_theme_mod('primary_color', '#32373c'); ?>;
    							}
    
    								.widget_archive ul li, .widget_nav_menu ul li, .widget_categories ul li, .widget_meta ul li,
    								.widget_recent_entries ul li, .widget_rss ul li, .widget_recent_comments ul li, .tagcloud a, .tags-links a, .cat-links a {
    								border-color: <?php echo get_theme_mod('primary_color', '#32373c'); ?>;
    							}
    
             </style>
    
    				 <style type="text/css">
    				 		  button, input[type="submit"]:hover,
    							.widget_archive ul li, .widget_nav_menu ul li, .widget_categories ul li, .widget_meta ul li,
    							.widget_recent_entries ul li, .widget_rss ul li, .widget_recent_comments ul li, .tagcloud a, .tags-links a, .cat-links a {
    								background: <?php echo get_theme_mod('secondary_color', '#eaeaea'); ?>;
    							}
    
    							button, input[type="submit"]:hover {
    							border-color: <?php echo get_theme_mod('secondary_color', '#eaeaea'); ?>;
    						}
    
             </style>
    
        <?php
    }
    
    wp_enqueue_script( 'wpb_slidepanel', get_template_directory_uri() . '/js/slidepanel.js', array('jquery'), '20160909', true );
    
    add_action( 'wp_enqueue_scripts', 'enqueue_load_fa' );
    function enqueue_load_fa() {
    
        wp_enqueue_style( 'load-fa', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' );
    
    }
    
    function wpb_add_google_fonts() {
    
    wp_enqueue_style( 'wpb-google-fonts', 'https://fonts.googleapis.com/css?family=Libre+Franklin:300,300i,400,400i,500,500i,700,700i|Rubik:300,300i,400,400i,500,500i,700|Work+Sans:300,400,500,700', false );
    }
    
    add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );
    Thread Starter supeherotim

    (@supeherotim)

    Hi, was a spelling mistake of underscores.

    Thread Starter supeherotim

    (@supeherotim)

    Thanks, I’ve fixed it now

    Thread Starter supeherotim

    (@supeherotim)

    Although now the menu items go off the screen

Viewing 15 replies - 1 through 15 (of 26 total)