my custom functions php affects the new codes

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

Status: resolved
  • This topic has 2 replies, 2 voices, and was last updated 4 y, 9 mo by  Jacob.
Viewing 2 reply threads
  • Author
    Posts
    • #12406

      Erick
      Member

      I get this error
      https://goo.gl/photos/qccP26YZQ3nMtHe77

      it also duplicates the archive menu in blog settings. since i am using a code to be able to add a different sidebar and also the classic view or default views disappeared

      <?php
      
      /**********************************************************************************************************
       *        __   _______    _    _   _ _____ _   _ _____ __  __ _____ ____         ____ ___  __  __
       *        \ \ / / ____|  / \  | | | |_   _| | | | ____|  \/  | ____/ ___|       / ___/ _ \|  \/  |
       *         \ V /|  _|   / _ \ | |_| | | | | |_| |  _| | |\/| |  _| \___ \      | |  | | | | |\/| |
       *          | | | |___ / ___ \|  _  | | | |  _  | |___| |  | | |___ ___) |  _  | |__| |_| | |  | |
       *          |_| |_____/_/   \_\_| |_| |_| |_| |_|_____|_|  |_|_____|____/  (_)  \____\___/|_|  |_|
       *
       *				custom functions for the theme
       **********************************************************************************************************/
      
      add_action( 'yt_header_end', 'yt_site_color_bars', 99 );
      function yt_site_color_bars(){
      	echo '<div class="site-color-preloader gradient clearfix hidden-xs"><div></div></div>';
      }
      
      add_filter( 'yt_meta_boxes', 'yt_custom_single_post_metabox_feb222015' );
      /**
       * Define the metabox and field configurations.
       *
       * @param  array $meta_boxes
       * @return array
       */
      function yt_custom_single_post_metabox_feb222015( $meta_boxes ) {
      
      	// Start with an underscore to hide fields from custom fields list
      	$shortname = 'yt_';
      	
      	
      	$meta_boxes[] = array(
      		'id'         => 'single_post_settins',
      		'title'      => 'Single Post Settings',
      		'pages'      => array( 'post', ), // Post type
      		'context'    => 'normal',
      		'priority'   => 'high',
      		'show_names' => true, // Show field names on the left
      		'fields'     => array(
      			
      			//Checkbox
      			array( 
      				'name' => 'Post thumbnail',
      				'desc' => '',
      				
      				'id' => $shortname . 'hide_single_post_thumbnail',
      				'std' => 1,
      				'type' => 'checkbox',
      				'settings' => array(
      					'label' => 'Hide post thumbnail',	
      					'folds' => '0',
      				)
      			)
      		)
      	);
      	
      	return $meta_boxes;
      }
      
      add_filter( 'wp_nav_menu_items', 'yt_custom_menu_login_dec082014', 15, 2 );
      
      if ( ! function_exists( 'yt_custom_menu_login_dec082014' ) ) {
      
      	function yt_custom_menu_login_dec082014 ( $items, $args ) {
      
      		if( $args->theme_location == 'primary' && 'hide' ){
      			
      			$args = array(
      		        'echo'           => false,
      		        'redirect'       => site_url( $_SERVER['REQUEST_URI'] ), 
      		        'form_id'        => 'loginform',
      		        'label_username' => __( 'Username' ),
      		        'label_password' => __( 'Password' ),
      		        'label_remember' => __( 'Remember Me' ),
      		        'label_log_in'   => __( 'Log In' ),
      		        'id_username'    => 'user_login',
      		        'id_password'    => 'user_pass',
      		        'id_remember'    => 'rememberme',
      		        'id_submit'      => 'wp-submit',
      		        'remember'       => true,
      		        'value_username' => NULL,
      		        'value_remember' => false
      			);
      			if( !is_user_logged_in() ){
      
      				$login_from = wp_login_form( $args );
      				$items .= sprintf( '<li class="menu-item menu-item-type-custom menu-item-login default-dropdown sub-menu-left pull-right">
      						<a href="javascript:void(0)" title="' .  __('Login', 'wpthms' ) . '"><i class="fa fa-user"></i> %s</a>
      						<ul class="sub-menu">
      							<li class="menu-item">
      								<div class="widget_login_form">%s</div>
      							</li>
      							<li><a href="%s">Register</a><a href="%s" title="Lost Password">Lost Password</a></li>
      						</ul>
      					</li>',
      					__('Login', 'wpthms'),
      					$login_from,
      					esc_url( wp_registration_url() ),
      					esc_url( wp_lostpassword_url() )
      				);
      			}else{
      				$items .= '<li class="menu-item menu-item-type-custom menu-item-login default-dropdown sub-menu-left pull-right">
      					<a href="' . esc_url( wp_logout_url( get_permalink() ) ) . '" title="Logout">Logout</a>
      				</li>';
      			}
      		}
      
      		return $items;
      	}
      }
      
      add_filter( 'yt_theme_options_stylingoptions_content', 'yt_theme_options_stylingoptions_content_12152014' );
      /**
       * Add option color picker to Styling Options -> Content
       */
      function yt_theme_options_stylingoptions_content_12152014( $options){
      	$options[] = array(
      		'name' => __('Content border color','wpthms'),
      		'desc' => '',
      		'id' => 'content_border_color',
      		'std' => '',
      		'type' => 'colorpicker',
      		'customize' => 1,
      	);
      	return $options;
      }
      
      add_filter( 'yt_site_less_css_variables', 'yt_site_less_css_variables_12152014' );
      /**
       * Filter the less vars
       */
      function yt_site_less_css_variables_12152014( $vars ){
      
      	$border_color = yt_get_options('content_border_color');
      	
      	if( !empty( $border_color ) ){
      		$vars['@grayBorderColor'] = $border_color;
      		$vars['@grayBorderColorTransparent'] = $border_color;
      	}
      
      	return $vars;
      
      }
      
      add_filter( 'yt_site_head_ads', 'custom_head_ads_tue04820140638' );
      
      function custom_head_ads_tue04820140638( $ads_content ){
      	if( is_home() || is_front_page() || is_page() )
              $ads_content = '';
      
      	return $ads_content;
      }
      
      add_filter( 'yt_site_foot_ads', 'custom_foot_ads_tue04820140638' );
      
      function custom_foot_ads_tue04820140638( $ads_content ){
      	if( is_singular('post') )
              $ads_content = '';
      
      	return $ads_content;
      }
      
      add_filter( 'yt_theme_options_blogsettings', 'yt_blog_archive_options_jun23');
      /**
       * Register Option fields
       */
      function yt_blog_archive_options_jun23( $options){
      	$options = array_merge( $options, array(
      		array(
      			'type' => 'subheading',
      			'name' => __('Archive','wpthms'),
      			'customize' => 1,
      		),
      		array(
      			'name' => __('Archive Main sidebar','wpthms'),
      			'desc' => __('Change main sidebar for archive pages','wpthms'),
      			'id' => 'archive_main_sidebar',
      			'std' => array(),
      			'options' => yt_get_registered_sidebars(),
      			'type' => 'select',
      		),
      		array(
      			'name' => __('Archive sub sidebar ','wpthms'),
      			'desc' => __('Change sub sidebar for archive pages','wpthms'),
      			'id' => 'archive_sub_sidebar',
      			'std' => array(),
      			'options' => yt_get_registered_sidebars(),
      			'type' => 'select',
      		),
      	) );
      	return $options;
      
      }
      
      add_filter( 'yt_theme_dynamic_sidebars_default', 'yt_blog_archive_sidebars_jun23' );
      /**
       * Filter the sidebars
       */
      function yt_blog_archive_sidebars_jun23( $default ){
      
      	if( !is_archive() )
      		return $default;
      
      	if( 'main-sidebar' == $default && ( $a_main_sidebar = yt_get_options('archive_main_sidebar') ) )
      		return $a_main_sidebar;
      
      	if( 'sub-sidebar' == $default && ( $a_sub_sidebar = yt_get_options('archive_sub_sidebar') ) )
      		return $a_sub_sidebar;
      
      	return $default;
      
      }
      
      add_filter( 'yt_theme_options_ads_manager', 'yt_register_options_08052015' );
      function yt_register_options_08052015( $options){
      	$options[] = array( 
      		'name' => __('After Hero Banner','wpthms'),
      		'desc' => __('This ads will be displayed between single post content automatically (only apply to the post which have at least 2 paragraphs )<br>Add your Ads code or use the following custom html structure:','wpthms') . '<br>' . esc_attr( '<a href="#" target="_blank"><img src="http://placehold.it/300x250"></a>' ),
      		'id' => 'site_after_hero_banner',
      		'std' => '<a href="#" target="_blank"><img src="http://placehold.it/300x250"></a>',
      		'type' => 'textarea',
      		'class' => 'yt-tabifiable-textarea',
      		'customize' => 1,
      		'settings' => array(
      			'sanitize' => false
      		),
      
      	);
      	return $options;
      
      }
      remove_action( 'yt_before_primary','yt_site_start_single_row',1 );
      add_action( 'yt_before_primary','yt_site_start_single_row', 2 );
      add_action( 'yt_before_primary','yt_display_hb_ad_08052015', 1.1 );
      function yt_display_hb_ad_08052015(){
      		if( !is_home() && !is_front_page() )
      			return;
      
      		if( yt_get_options( 'site_after_hero_banner' ) ):
      			$output = '<div class="site-below-hero-ads text-center" style="padding: 12px 0; border-bottom: 1px solid #eee;"><div class="container">';
      			$output .= stripslashes( yt_get_options( 'site_after_hero_banner' ) );
      			$output .= '</div></div>';
      			echo do_shortcode( $output );
      		endif;
      }
      
      add_filter( 'yt_simple_post_views_use_ajax', '__return_true' );
      • This topic was modified 4 y, 9 mo by  Erick.
      • This topic was modified 4 y, 9 mo by  Erick.
      • This topic was modified 4 y, 9 mo by  Erick.
      • This topic was modified 4 y, 9 mo by  Erick.
    • #12409

      Erick
      Member

      is this code for adding adds below the hero banner

      add_filter( 'yt_theme_options_ads_manager', 'yt_register_options_08052015' );
      function yt_register_options_08052015( $options){
      	$options[] = array( 
      		'name' => __('After Hero Banner','wpthms'),
      		'desc' => __('This ads will be displayed between single post content automatically (only apply to the post which have at least 2 paragraphs )<br>Add your Ads code or use the following custom html structure:','wpthms') . '<br>' . esc_attr( '<a href="#" target="_blank"><img src="http://placehold.it/300x250"></a>' ),
      		'id' => 'site_after_hero_banner',
      		'std' => '<a href="#" target="_blank"><img src="http://placehold.it/300x250"></a>',
      		'type' => 'textarea',
      		'class' => 'yt-tabifiable-textarea',
      		'customize' => 1,
      		'settings' => array(
      			'sanitize' => false
      		),
      
      	);
      	return $options;
      
      }
      remove_action( 'yt_before_primary','yt_site_start_single_row',1 );
      add_action( 'yt_before_primary','yt_site_start_single_row', 2 );
      add_action( 'yt_before_primary','yt_display_hb_ad_08052015', 1.1 );
      function yt_display_hb_ad_08052015(){
      		if( !is_home() && !is_front_page() )
      			return;
      
      		if( yt_get_options( 'site_after_hero_banner' ) ):
      			$output = '<div class="site-below-hero-ads text-center" style="padding: 12px 0; border-bottom: 1px solid #eee;"><div class="container">';
      			$output .= stripslashes( yt_get_options( 'site_after_hero_banner' ) );
      			$output .= '</div></div>';
      			echo do_shortcode( $output );
      		endif;
      }
    • #12425

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

© Copyright 2020 by wpthms.com. All Rights Reserved.