Home Forums Basel support forum Add H1 to TITLE and H2 to SUBTITLE

Add H1 to TITLE and H2 to SUBTITLE

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #10371

    Giulio
    Participant

    Hi,

    please I would to add H1 to title field and H2 to subtitle field. Could you suggest to me the way to do it? Then I’d like also to set H1 on the title of every post inside the page “blog” and in every title of single posts.

    Thank you really much for your availability!

    #10372

    Artem Temos
    Keymaster

    Hello,

    What exactly do you call title and subtitle? As for blog, so you can edit its title tag in the content.php file.

    Kind Regards

    #10373

    Giulio
    Participant

    Here is a screenshot. Take a look please! ๐Ÿ™‚ Title and subtitle.

    About the blog I saw the content.php, but I do not understand where I have to add the H1. There are many title with H3 and I do not understand which is the right one. Please!

    Attachments:
    You must be logged in to view attached files.
    #10375

    Artem Temos
    Keymaster

    Replace all occurrences in the content.php file. As for the section title element, add the following code to the child theme and replace all tag names as you need.

    	function basel_shortcode_title( $atts ) {
    		extract( shortcode_atts( array(
    			'title' 	 => 'Title',
    			'subtitle' 	 => '',
    			'after_title'=> '',
    			'link' 	 	 => '',
    			'color' 	 => 'default',
    			'style'   	 => 'default',
    			'size' 		 => 'default',
    			'subtitle_font' => 'default',
    			'align' 	 => 'center',
    			'el_class' 	 => '',
    			'css'		 => ''
    		), $atts) );
    
    		$output = $attrs = '';
    
    		$title_class = '';
    
    		$title_class .= ' basel-title-color-' . $color;
    		$title_class .= ' basel-title-style-' . $style;
    		$title_class .= ' basel-title-size-' . $size;
    		$title_class .= ' text-' . $align;
    
    		$separator = '<span class="title-separator"><span></span></span>';
    
    		if( function_exists( 'vc_shortcode_custom_css_class' ) ) {
    			$title_class .= ' ' . vc_shortcode_custom_css_class( $css );
    		}
    
    		if( $el_class != '' ) {
    			$title_class .= ' ' . $el_class;
    		}
    
    		$output .= '<div class="title-wrapper ' . $title_class . '">';
    
    			if( $subtitle != '' ) {
    				$output .= '<span class="title-subtitle font-'. esc_attr( $subtitle_font ) .'">' . $subtitle . '</span>';
    			}
    
    			$output .= '<div class="liner-continer"> <span class="left-line"></span> <span class="title">' . $title . $separator . '</span> <span class="right-line"></span> </div>';
    
    			if( $after_title != '' ) {
    				$output .= '<span class="title-after_title">' . $after_title . '</span>';
    			}
    
    		$output .= '</div>';
    
    		return $output;
    
    	}
    
    	add_shortcode( 'basel_title', 'basel_shortcode_title' );

    Regards

    #10376

    Giulio
    Participant

    The post titles works! Great, thank you!

    About the title and subtitle I’m not sure that you had understood what I would to do. Could be more clear about your suggestion? I would to set “title” H1 and “subtitle” H2.

    Thanks for your patience.

    #10377

    Artem Temos
    Keymaster

    You just need to change tag names in the code we sent you. Should get something like this

    function basel_shortcode_title( $atts ) {
    		extract( shortcode_atts( array(
    			'title' 	 => 'Title',
    			'subtitle' 	 => '',
    			'after_title'=> '',
    			'link' 	 	 => '',
    			'color' 	 => 'default',
    			'style'   	 => 'default',
    			'size' 		 => 'default',
    			'subtitle_font' => 'default',
    			'align' 	 => 'center',
    			'el_class' 	 => '',
    			'css'		 => ''
    		), $atts) );
    
    		$output = $attrs = '';
    
    		$title_class = '';
    
    		$title_class .= ' basel-title-color-' . $color;
    		$title_class .= ' basel-title-style-' . $style;
    		$title_class .= ' basel-title-size-' . $size;
    		$title_class .= ' text-' . $align;
    
    		$separator = '<span class="title-separator"><span></span></span>';
    
    		if( function_exists( 'vc_shortcode_custom_css_class' ) ) {
    			$title_class .= ' ' . vc_shortcode_custom_css_class( $css );
    		}
    
    		if( $el_class != '' ) {
    			$title_class .= ' ' . $el_class;
    		}
    
    		$output .= '<div class="title-wrapper ' . $title_class . '">';
    
    			if( $subtitle != '' ) {
    				$output .= '<h2 class="title-subtitle font-'. esc_attr( $subtitle_font ) .'">' . $subtitle . '</h2>';
    			}
    
    			$output .= '<div class="liner-continer"> <span class="left-line"></span> <h1 class="title">' . $title . $separator . '</h1> <span class="right-line"></span> </div>';
    
    			if( $after_title != '' ) {
    				$output .= '<span class="title-after_title">' . $after_title . '</span>';
    			}
    
    		$output .= '</div>';
    
    		return $output;
    
    	}
    
    	add_shortcode( 'basel_title', 'basel_shortcode_title' );
    #10378

    Giulio
    Participant

    Ok, where I can find this code? I’ve not found it on functions.php

    #10379

    Giulio
    Participant

    Ok, shortcodes.php. Now it works. You’re great, thank you!

    #10384

    Artem Temos
    Keymaster

    Actually, you need to copy it to the child theme functions.php file to prevent loosing changes after parent theme update.

Viewing 9 posts - 1 through 9 (of 9 total)