• Resolved misharnet

    (@misharnet)


    I am creating my first WP Theme and I would like to upload it to www.ads-software.com. That’s why I use, as recommended, Theme Check Plugin.

    I resolved other issues, except these two.
    1. REQUIRED: The <title> tags can only contain a call to wp_title(). Use the wp_title filter to modify the output

    I understand that is related to title tag in header.php, am I wrong?
    This is my header:

    <!doctype html>
    <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
    <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?>> <![endif]-->
    <!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>> <![endif]-->
    <!--[if IE 8]>    <html class="no-js lt-ie9" <?php language_attributes(); ?>> <![endif]-->
    <!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
    <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
    
    <head>
    	<meta charset="<?php bloginfo( 'charset' ); ?>" />
    	<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
    	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title><?php wp_title( '|', true, 'right' ); ?></title>
    	<meta http-equiv="cleartype" content="on">
    
    	<!-- Responsive and mobile friendly stuff -->
    	<meta name="HandheldFriendly" content="True">
    	<meta name="MobileOptimized" content="320">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
    
    	<link rel="profile" href="https://gmpg.org/xfn/11" />
    	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    
    	<?php wp_head(); ?>
    </head>

    What is wrong with it?

    2. REQUIRED: screen_icon() found in the file class-tgm-plugin-activation.php. Deprecated since version 3.8.

    Line 381: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) );
    
    Line 1584: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) );

    I understand that, but I don’t know with what should I replace it?

    I am really greatfull for your potential answers.

Viewing 15 replies - 1 through 15 (of 31 total)
  • I am having this EXACT same issue with the “1. REQUIRED: The <title> tags can only contain a call to wp_title(). Use the wp_title filter to modify the output”, I am literally one error away from having this done.

    I have the exact same code as misharnet in the title tag. I’ve copied the code from the twenty fourteen theme, both for <title> and the proper title function/filter to go with it, and it still returns error. The checker however still has no problem with the twenty fourteen theme itself which leads me to think that there is something going on outside of the <title> tag itself, contrary to what the error states.

    The <title> is relatively self-explanatory…

    You have:

    <?php wp_title( '|', true, 'right' ); ?>

    You should have:

    <?php wp_title(); ?>

    I’d be pretty sute that will fix that issue.

    Seond, with the scrren_icons() issue…

    https://tinygod.pt/wheres-my-screen-icon/

    Thread Starter misharnet

    (@misharnet)

    Well, thanks for your suggestion, but it didn’t remove Theme Check warning.
    <?php wp_title( '|', true, 'right' ); ?> have some other themes as well, and they pass Theme Check with it.

    Obviously, I don’t know how to filter ir right, as Theme Check suggested it. Maybe the problem is somewhere in these lines of codes in my functions.php :

    /**
     * Creates a nicely formatted and more specific title element text
     * for output in head of document, based on current view.
     * @param string $title Default title text for current view.
     * @param string $sep Optional separator.
     * @return string The filtered title.
     */
    function nsblog_wp_title( $title, $sep ) {
    	global $paged, $page;
    
    	if ( is_feed() ) {
    		return $title;
    	}
    
    	// Add the blog name.
    	$title .= get_bloginfo( 'name' );
    
    	// Add the blog description for the home/front page.
    	$site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) ) {
    		$title = "$title $sep $site_description";
    	}
    
    	// Add a page number if necessary.
    	if ( $paged >= 2 || $page >= 2 ) {
    		$title = "$title $sep " . sprintf( esc_html__( 'Page %s', 'nsblog' ), max( $paged, $page ) );
    	}
    
    	return $title;
    }
    add_filter( 'wp_title', 'nsblog_wp_title', 10, 2 );

    Thank you catacaustic, but that is what I had before and is what caused me to copy/paste from the in the box theme in the first place. Thank you for your assistance though.

    I also have the exact same function/filter as misharnet. It returned the error with one I found elsewhere as well.

    Moderator bcworkz

    (@bcworkz)

    There is nothing wrong with <?php wp_title( '|', true, 'right' ); ?>, it is in the twentyfourteen theme which of course passes. As misharnet pointed out, many themes have this.

    What is probably the problem is what else is in the <title> tags besides the PHP block. The title block must pass this regexp:
    '/(?=<title>(.*)<\/title>)(?!<title>\s*<\?php\s*wp_title\([^\)]*\);\s*\?>\s*<\/title>)/s'
    or the error message noted by OP will be generated. The entire title block could match that of twentyfourteen:
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    This should pass the title checks.

    I don’t know if theme check checks title hooks, if it did, I would expect a different error message. AFAIK, the noted regexp failure is the only way to generate this particular error message

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Hi! In the future, when posting about plugins, including theme check, it’s helpful if you post in their specific forum:
    https://www.ads-software.com/support/plugin/theme-check

    If you had, I would have noticed this sooner. ??

    <title><?php wp_title( '|', true, 'right' ); ?></title>

    There’s nothing wrong with that code, and it will pass theme-check just fine.

    If you’re getting that title message, then somewhere, you have a <title>...</title> pair of tags that has something else in it. Could be in any of the PHP files. That’s not allowed.

    As for screen_icon, there is no replacement because screen icons no longer are displayed. Dashicons are used now.

    Alright, so running on the presumtion that there is a rougue set of title tags somewhere I commented out the title tags in my header, and it still returns that error, even though there is no title whatsoever.

    This is the odd thing though, the page itself of course has no title tags whatsoever, neither does any other files other than the header.php, which is the only file that has any business with that tag. To make even more sure I completely removed the code from the file saved and checked, still returned the error.

    Using jedit, I searched all my files at once, making double sure that I combed everything. It occures only once in the header.php.

    There is either more to this error than what we realize, or it’s a bug. Because it seems like no matter what with this theme it returns that error, regardless if the title tags even exists or not.

    I appreciate all of your help, I really hope we can get to the bottom of this.

    Here is my header, title tag re-inserted of course.

    <head>
    		<meta charset='<?php bloginfo('charset'); ?>'>
    		<meta name='viewport' content='width=device-width'>
    
    		<meta http-equiv="X-UA-Compatible" content="IE=edge">
    
    		<title><?php wp_title('|', true, 'right'); ?></title>
    
    		<meta name="description" content="">
    		<meta name="viewport" content="width=device-width, initial-scale=1">
    
    		<script src="js/vendor/modernizr-2.6.2.min.js"></script>
    
    		<?php wp_head(); ?>
    	</head>

    Update: I made the title function return 0 at all times, still returns the error.

    Update: I just checked at themecheck.org, it passed with flying colors.

    https://themecheck.org/score/wordpress_theme_devonscustom.html

    bug?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Not a bug. Guaranteed. It can’t find something that isn’t actually there.

    Also, themecheck.org is not us, and not run by me. I have nothing to do with it.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    so running on the presumtion that there is a rougue set of title tags somewhere I commented out the title tags in my header

    FYI, “commented out” is suggestive here. The theme check code is reading your code directly, it’s not running it. It doesn’t know about comments, be they PHP or HTML style comments. If you have <title> anywhere, even in a comment, it will see it.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Ahh. Well, yes, it will check all the files in the theme. It can’t know how you’ve structured your code, or whether a file is used or not. For any of the PHP based checks, all of the PHP code in the entire directory is read.

    Thread Starter misharnet

    (@misharnet)

    Soory Samuel, I am not still familiar enough with these forums. That is why I posted this topic in this one. Sorry again for not replying to you sooner, in my country now is 6 am, so I was sleeping when you first replied.
    To me is only important does it check only files in theme directory or in any other related directories, I mean if any plugin is activated till it’s performing checking …

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Theme Check problem’ is closed to new replies.