Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #626761

    Good evening everbody
    please have a look at that screenshot:
    https://drive.google.com/open?id=0BzF3a9LXV99JMFFDRERwU1kwVWM

    You see that this post (and all others as well) have the H1 doubled
    As you probably know there must not be more than one H1 per URL

    How can we solve that??

    1; What do we have to do to remove the big one? (the second one)
    2: How can we put another Textstring into the “main-title entry-title” ??

    Regards Martin

    #627383

    Hey pixopolis2222,

    Please edit your post and choose to display only breadcrumbs under Title Bar Settings – http://i.imgur.com/0LubSme.png

    Best regards,
    Yigit

    #627842

    Hi Yigit
    sorry but taking a broom and sweep n issue under our bed is not a “solution” we want to use too often.

    Where do the double h1 icome from?
    It was a suggestion of one of your collegues
    He offered us this code (i guess you see what it is about)

    add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
    function fix_single_post_title($args,$id)
    {
        if ( $args['title'] == 'Blog - Die aktuellsten Neuigkeiten' )
        {
            $args['title'] = get_the_title($id);
            $args['link'] = get_permalink($id);
            $args['heading'] = 'h1';
        }
    
        return $args;
    }

    Questions

    1: How has the argument to be like if we want just a <span> instead of an <h1> ( $args[‘heading’] = ‘h1’; —> …? ) ??
    2: How should the code be like if we want to call the content of a certain custom field instead of “get_the_title($id);” ?

    Regards Martin

    #627843

    Hi!

    1- That line should be

    $args['heading'] = 'span';

    2- What exactly is the content you would like to echo?

    Best regards,
    Yigit

    #774469

    Hi
    probably in relation to this issue we found another thing that is realy strange.
    Look at these two posts please:
    1: http://www.trauerkarten-druck.com/magazin/sprueche-fuer-trauerkarten/
    2: http://www.trauerkarten-druck.com/magazin/trauersprueche-fuer-beileidskarten/
    In Number 2 you see a H1 (“Trauersprüche für Beileidskarten”) just as the beginning of the posts content
    Where does this line come from??? Its not in the content!!!
    Other posts do not have a H1 at this place.

    That really looks like a bug.
    Regards Martin

    #774471

    and another weird thing:
    If i change to postformat from “standard” to “link” (just for a test) ….the H1 changes to something completly different.

    One more: The issue does not come from our childtheme.
    We emptied the functions.php from our child-theme to check but the issue is still there.

    Where does this weird inconsistence come from?

    #774478

    OK – i got it but i have to say that this is something you should REALLY write down somewhere:
    If you dont use ALB – the posttitle is printed automatically on top of the post
    If you use ALB – it doesnt.

    This behaviour might be by purpose – but nevertheless ist confusing and not logic.
    It needs a lot of time to figure that out

    #774649

    BACK AGAIN

    Before i become crazy about that ……
    There are so many strange dependencys (H1 in title depending from “Don’t display image on single post” / H1 in Content depending from using ALB or not / H1 in title depending from using ALB or not….) that i have no other idea than to suspect a huge bug.
    This is so strange that i cant decide where to begin

    Maybe its better to start from scratch.
    What i want:
    1: using ALB
    2: No H1 in Content
    3: H1 in title

    What do we already got in functions.php

    <?php
    add_filter('avf_title_args', 'change_title_tag', 10, 2);
    function change_title_tag($args,$id)
    {
            $args['link'] = get_permalink($id);
            $args['heading'] = 'div';
        return $args;
    }
    add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
    function fix_single_post_title($args,$id)
    {
        if ( $args['title'] == 'Blog - Die aktuellsten Neuigkeiten' )
        {
            $args['title'] = get_the_title($id);
            $args['link'] = get_permalink($id);
            $args['heading'] = 'h1';
        }
    
        return $args;
    }
    //$avia_config['imgSize']['square-custom'] = array('width'=>300, 'height'=>300); // small image for blogs
    //$avia_config['imgSize']['square2'] = array('width'=>400, 'height'=>400); // small image for blogs
    
    function enqueue_parent_theme_style() {
          wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style');
    
    function theme_name_scripts() {
    	wp_enqueue_style( 'style-name', get_stylesheet_uri() );
    }
    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
    
    /* Activate Avia debug mode */
    add_action('avia_builder_mode', "builder_set_debug");
    function builder_set_debug()
    {
    	return "debug";
    }
    /* excerpt lenght */
    add_filter('avf_postgrid_excerpt_length','avia_change_postgrid_excerpt_length', 10, 1);
    function avia_change_postgrid_excerpt_length($length)
    {
       $length = 150;
       return $length;
    }
    
    //removes comments from Combo Widget  // 
    
    class avia_combo_widget extends WP_Widget {
    
    		function avia_combo_widget() {
    			//Constructor
    			$widget_ops = array('classname' => 'avia_combo_widget', 'description' => 'A widget that displays your popular posts, recent posts, recent comments and a tagcloud' );
    			$this->WP_Widget( 'avia_combo_widget', THEMENAME.' Combo Widget', $widget_ops );
    		}
    
    		function widget($args, $instance)
    		{
    			// prints the widget
    
    			extract($args, EXTR_SKIP);
    			$posts = empty($instance['count']) ? 4 : $instance['count'];
    
    			echo $before_widget;
    			echo "<div class='tabcontainer border_tabs top_tab tab_initial_open tab_initial_open__1'>";
    
    			echo '<div class="tab first_tab active_tab widget_tab_popular"><span>'.__('Popular', 'avia_framework').'</span></div>';
    			echo "<div class='tab_content active_tab_content'>";
    			avia_get_post_list('cat=&orderby=comment_count&posts_per_page='.$posts);
    			echo "</div>";
    
    			echo '<div class="tab widget_tab_recent"><span>'.__('Recent', 'avia_framework').'</span></div>';
    			echo "<div class='tab_content'>";
    			avia_get_post_list('showposts='. $posts .'&orderby=post_date&order=desc');
    			echo "</div>";
    
    			echo '<div class="tab last_tab widget_tab_tags"><span>'.__('Tags', 'avia_framework').'</span></div>';
    			echo "<div class='tab_content tagcloud'>";
    			wp_tag_cloud('smallest=12&largest=12&unit=px');
    			echo "</div>";
    
    			echo "</div>";
    			echo $after_widget;
    		}
    
    		function update($new_instance, $old_instance)
    		{
    			$instance = $old_instance;
    			foreach($new_instance as $key=>$value)
    			{
    				$instance[$key]	= strip_tags($new_instance[$key]);
    			}
    
    			return $instance;
    		}
    
    		function form($instance) {
    			//widgetform in backend
    
    			$instance = wp_parse_args( (array) $instance, array('count' => 4) );
    			if(!is_numeric($instance['count'])) $instance['count'] = 4;
    
    	?>
    			<p>
    			<label for="<?php echo $this->get_field_id('count'); ?>">Number of posts you want to display:
    			<input class="widefat" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo esc_attr($instance['count']); ?>" /></label></p>
    
    		<?php
    		}
    	}
    	add_action( 'ava_after_main_menu', 'enfold_customization_header_widget_area' );
    function enfold_customization_header_widget_area() {
    	dynamic_sidebar( 'header' );
    }
    add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
    function enqueue_font_awesome() {
     
    	wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
     
    }
    add_filter('avf_which_archive_output','avf_change_which_archive', 10, 3);
    function avf_change_which_archive($output)
    {
    	if(is_category())
    	{
    		$output = single_cat_title('',false);
    	}
    
    	return $output;
    }

    Please help me not to end up in a psychward and let me know how i can achieve that (which by the way should not be that complicate, right?)

    #775394

    Hi,

    Can you please try changing following code at the top

    add_filter('avf_title_args', 'change_title_tag', 10, 2);
    function change_title_tag($args,$id)
    {
            $args['link'] = get_permalink($id);
            $args['heading'] = 'div';
        return $args;
    }

    to following one

    add_filter('avf_title_args', 'change_title_tag', 10, 2);
    function change_title_tag($args,$id)
    {
    if(!is_single()){
            $args['link'] = get_permalink($id);
            $args['heading'] = 'div';
    }
        return $args;
    }

    Applying this change should make titles in title bar for single post H1 when posts are created with or without ALB :)

    Best regards,
    Yigit

    #775457

    Hi Yigit
    thanks for helping – this worked so far.

    Can you please leave that thread open for some days until we are sure that its really solved?

    Thanx again and have a nice day
    Kind regards
    Martin

    #775458

    Hey Martin,

    Sure, we will leave the thread open and it will be on hold until you reply :)

    Feel free to start a new thread if you have any other questions or issues :)

    Regards,
    Yigit

    #775464

    Back again:
    Since we need a H1 ( a correct SEO needs always one H1 per page) on every page and not only on single-blog-posts we had to edit the code to:

    if ( is_single() && is_category() ) {
            $args['link'] = get_permalink($id);
            $args['heading'] = 'div';
    }
        return $args;
    }

    Can you pllease confirm that it is correct?
    And why did you suggest this: “if(!is_single())”
    Doesnt that “! is_single” mean “not equal as” ?

    Regards Martin

    #775470

    Hi!

    Yes, !is_single means “if it is not single post” and with your addition it says “and if it’s category”. Since you would like to display H1 in all posts regardless they were created with ALB or not :)

    Best regards,
    Yigit

    #775516

    Now i am a bit confused again.
    The code you provided said: “If its not a single than use a “div” instead a h1″?
    Is that correct?
    My code now says: “If its a single or a category than use h1″
    Correct?

    Best regards Martin

    #776054

    Hi,

    No, now your code says “use Div if single post or category page”

    You can use

    add_filter('avf_title_args', 'change_title_tag', 10, 2);
    function change_title_tag($args,$id)
    {
    if(!is_single() || !is_category()){
            $args['link'] = get_permalink($id);
            $args['heading'] = 'div';
    }
    else{
            $args['link'] = get_permalink($id);
            $args['heading'] = 'h1';
    }
        return $args;
    }

    Best regards,
    Yigit

    • This reply was modified 6 years, 11 months ago by Yigit.
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.