Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1270252

    Hi

    On the single product page, is it possible to replace the “main-title.entry-title” in the title bar with the “product.title.entry-title”?

    Many Thanks
    Regards
    Colin

    #1270563

    Hi Colin,

    The single product page title already uses:

    .product_title.entry-title

    Best regards,
    Nikko

    #1270566

    Hi Nikko

    Please see the attached image for what I actually mean
    HEADING

    Many Thanks
    Regards
    Colin

    #1270772

    Hi Colin,

    Thanks for the clarification.
    Please add this PHP code at the bottom of your child theme’s functions.php file:

    function avia_title($args = false, $id = false)
    {
    	global $avia_config;
    
    	if(!$id) $id = avia_get_the_id();
    
    	$header_settings = avia_header_setting();
    	if($header_settings['header_title_bar'] == 'hidden_title_bar') return "";
    
    	$defaults 	 = array(
    
    		'title' 		=> get_the_title($id),
    		'subtitle' 		=> "",
    		'link'			=> get_permalink($id),
    		'html'			=> "<div class='{class} title_container'><div class='container'>{heading_html}{additions}</div></div>",
    		'heading_html'	=> "<{heading} class='main-title entry-title {heading_class}'>{title}</{heading}>",
    		'class'			=> 'stretch_full container_wrap alternate_color '.avia_is_dark_bg('alternate_color', true),
    		'breadcrumb'	=> true,
    		'additions'		=> "",
    		'heading'		=> 'h1',
    		'heading_class'	=> ''
    	);
    	
    	if ( is_product() ) {
    		$defaults['heading_html'] = "<{heading} class='product-title entry-title {heading_class}'>{title}</{heading}>";
    	}
    
    	if ( is_tax() || is_category() || is_tag() )
    	{
    		global $wp_query;
    
    		$term = $wp_query->get_queried_object();
    		$defaults['link'] = get_term_link( $term );
    	}
    	else if(is_archive())
    	{
    		$defaults['link'] = "";
    	}
    
    
    	// Parse incomming $args into an array and merge it with $defaults
    	$args = wp_parse_args( $args, $defaults );
    
    	/**
    		 * @used_by		config-woocommerce\config.php avia_title_args_woopage()				10
    		 * @since < 4.0
    		 * @return array
    		 */
    	$args = apply_filters( 'avf_title_args', $args, $id );
    
    	//disable breadcrumb if requested
    	if($header_settings['header_title_bar'] == 'title_bar') $args['breadcrumb'] = false;
    
    	//disable title if requested
    	if($header_settings['header_title_bar'] == 'breadcrumbs_only') $args['title'] = '';
    
    
    	// OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
    	extract( $args, EXTR_SKIP );
    
    	if(empty($title)) $class .= " empty_title ";
    	$markup = avia_markup_helper(array('context' => 'avia_title','echo'=>false));
    	if(!empty($link) && !empty($title)) $title = "<a href='".$link."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".esc_attr( $title )."' $markup>".$title."</a>";
    	if(!empty($subtitle)) $additions .= "<div class='title_meta meta-color'>".wpautop($subtitle)."</div>";
    	if($breadcrumb) $additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true));
    
    
    	if(!$title) $heading_html = "";
    	$html = str_replace('{heading_html}', $heading_html, $html);
    
    
    	$html = str_replace( '{class}', $class, $html );
    	$html = str_replace( '{title}', $title, $html );
    	$html = str_replace( '{additions}', $additions, $html );
    	$html = str_replace( '{heading}', $heading, $html );
    	$html = str_replace( '{heading_class}', $heading_class, $html );
    
    	if(!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview())
    	{
    		$avia_config['small_title'] = $title;
    	}
    	else
    	{
    		return $html;
    	}
    }

    Hope it helps.

    Best regards,
    Nikko

    #1270847

    Hi Nikko

    Thanks for the reply and the code to add.

    I added the code to the child theme functions.php file and it just make the text in the title bar disappear

    Screen shot here

    When i wipe my cursor over where the title should be to see if anything is actually there I can see the original shop title “Art” but it is smaller

    Screen shot 2

    Many Thanks
    Regards
    Colin

    #1270953

    Hi Again Nikko

    I managed to find a post from 2015 with the following code which worked perfectly

    add_filter( 'avf_title_args', 'avf_product_titlee', 0, 2 );
    function avf_product_titlee( $args, $id ) {
    	if ( is_singular('product') ) { $args['title'] = get_the_title($id); }
    	return $args;
    }

    Many Thanks
    Regards
    Colin

    #1270975

    Hi Colin,

    I’m glad to hear that and it’s a much simpler solution :)
    Let us know if you need further assistance.

    Best regards,
    Nikko

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.