Viewing 11 replies - 1 through 11 (of 11 total)
  • You seem to have some problems in the header.php file – causing mark-up errors –

    https://validator.w3.org/check?uri=http%3A%2F%2Fwww.artbyherbie.com%2F4485%2Fmagnetic-vinyl-removable-taxi-door-cards-border-exclusive-travel%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

    You might try deactivating your plugins to see if any are doing that.

    Thread Starter Johnny Bravo

    (@herbiehysteria)

    i have edited my header.php file before for other issues. it may be snippets of code i’ve left in there but i’m really not 100% confident to see what is causing it. Can anyone identify any apparent issues:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml" xmlns:og="https://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
    
    <head profile="https://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <link rel="icon" href="<?php bloginfo('siteurl'); ?>/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" type="image/x-icon" />
    <!--[if IE 6]>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/iestyle.css" />
    <![endif]-->
    <style type="text/css" media="screen">
    
    <?php
    global $post;
    $current_page_id = $post->ID;
    // Checks to see whether it needs a sidebar or not
    if ( empty($withcomments) && !is_single() ) {
    ?>
    	#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
    <?php } else { /* No sidebar */?>
    	#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
    <?php } ?>
    <?php if ( $current_page_id == 2748 ){?>
    	#menu-item-2757 a {
    		background: url(https://www.artbyherbie.com/wp-content/themes/indezinerpaperwall/images/menu_link_bg.gif) repeat-x center;
    		color: #64431E;
    	}
    <?php } ?>
    </style>
    
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    
    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <meta property="og:title" content="<?php the_title(); ?>"/>
    <meta property="og:type" content="<?php
    
      if (is_singular()) { echo "article"; } else { echo "website";}
    ?>"/>
    <!-- Put the following javascript before the closing </head> tag. -->
    <script>
      (function() {
        var cx = '017502216997493018940:WMX205779490';
        var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
        gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
            '//www.google.com/cse/cse.js?cx=' + cx;
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
      })();
    </script>
    
    <?php if (have_posts()):while(have_posts()):the_post(); endwhile; endif;?>
    
    <!-- if page is content page -->
    <?php if (is_single()) { ?>
    <meta property="og:url" content="<?php the_permalink() ?>"/>
    <meta property="og:title" content="<?php single_post_title(''); ?>" />
    <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
    <meta property="og:type" content="article" />
    <meta property="og:image" content="<?php if (function_exists('wp_get_attachment_thumb_url')) {echo wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID)); }?>" />  
    
    <!-- if page is others -->
    <?php } else { ?>
    <meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
    <meta property="og:description" content="<?php bloginfo('description'); ?>" />
    <meta property="og:type" content="website" />
    <meta property="og:image" content="https://www.artbyherbie.com/wp-content/uploads/2012/12/app75x75.png" /> <?php } ?>
    <?php wp_head(); ?>
    </head>
    <body <?php body_class(); ?>>
    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({appId: '157766117692061', status: true, cookie: true,
                 xfbml: true});
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
    </script>
    <div id="main_container">
    
    <div id="header" role="banner">
    
    	       	<div class="logo">
    
                </div>
    
    </div>
    
    <div class="center_content">
    	<div class="center_content_top">
        	<div class="center_content_bottom">
    
    		<?php
    		function do_the_menu (){
    			wp_page_menu('show_home=1&exclude=6,8, 10, 12, 14, 16, 32, 73, 75, 385, 389, 392, 398, 400, 404, 407, 509, 620, 651, 747, 765, 1037, 1038, 1039, 1040, 1112, 1644, 1826, 2544&menu_class=menu');
    		}
    		//first check if wp_nav_menu has been declared
    		if (function_exists('wp_nav_menu')){
    			//if it has been declared then use it
    			wp_nav_menu( array( 'sort_column' => 'menu_order',
    								'theme_location' => 'primary',
    								'menu' => 'main',
    								'menu_class' => 'sf-menu',
    								'fallback_cb' => 'do_the_menu',
    								'container_class' => 'menu'
    							  )
    						);
    		}else{
    			//if wp_nav_menu doesnt exist we use wp_page_menu
    			do_the_menu();
    		}
    		?>

    problem is with these two lines:

    <meta property="og:title" content="<?php single_post_title(''); ?>" />
    <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />

    one of you plugins (‘disqus’ ?) seems to be prepending some script before the excerpt.

    as @wpyogi already suggested:

    You might try deactivating your plugins to see if any are doing that.

    or you will need to rewrite the line with ‘the_excerpt’…

    possibly to (totally untested):

    <meta property=”og:description” content=”<?php echo esc_attr( wp_trim_words( strip_tags( $post->content ), 55 ) ); ?>” />

    https://codex.www.ads-software.com/Function_Reference/wp_trim_words
    https://codex.www.ads-software.com/Function_Reference/esc_attr

    Thread Starter Johnny Bravo

    (@herbiehysteria)

    alchymyth, thanks i’ve just about narrowed it down to disqus causing it, trying your remedy now..

    Thread Starter Johnny Bravo

    (@herbiehysteria)

    it worked! can you confirm on your end? thanks

    it has removed the stray output, but now the opengraph description content (which had the error output before) is empty:

    <meta property="og:description" content="" />

    too late for me now; I’ll have a closer look tomorrow ??

    PS:

    my mistake:
    (has to be $post->post_content; I also added some code to remove shortcodes if present)

    i.e. change the line to:

    <meta property="og:description" content="<?php echo esc_attr( wp_trim_words( strip_tags( strip_shortcodes( $post->post_content ) ), 55 ) ); ?>" />

    Thread Starter Johnny Bravo

    (@herbiehysteria)

    thanks so far, i will try re-adding FB OG tags in the meantime ??

    I added a PS:

    the code is now:

    <meta property="og:description" content="<?php echo esc_attr( wp_trim_words( strip_tags( strip_shortcodes( $post->post_content ) ), 55 ) ); ?>" />
    Thread Starter Johnny Bravo

    (@herbiehysteria)

    aah, changed it – thanks you!

    I checked your link, and the latest edits seems to have fixed the problem.

    if this is all, please mark the topic as ‘resolved’ – thanks ??

    Thread Starter Johnny Bravo

    (@herbiehysteria)

    done, thanks again!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Post text repeated in header, pushing alignment down’ is closed to new replies.