• Resolved ewcadmin

    (@ewcadmin)


    Hi.
    I’d like to change the text in the no-results.php page.

    When someone searches for something that isn’t in my blog, I’d like to have a link to my contact page.
    (https://www.english-with-craig.co.uk/contactform.html)

    When I change the current text I get an error:

    Parse error: syntax error, unexpected T_STRING in /home/fookface/public_html/ewc/blog/wp-content/themes/sixhours/no-results.php on line 24

    I can change one or two words, but if I try to type something like, “Please send me a message and I’ll try to answer your question”, it comes up with the error.

    This makes no sense to me.

    If you could tell me, I’d appreciate it.

    Thank you.

    Craig

Viewing 7 replies - 1 through 7 (of 7 total)
  • paste your no-results.php file here

    Thread Starter ewcadmin

    (@ewcadmin)

    Hi, thanks.
    The text I’d like to change is:

    <p><?php _e( ‘Sorry, but nothing matched your search terms. Please try again with some different keywords.’, ‘sixhours’ ); ?></p>

    I’d like to change the words and include a link to my contact page.

    I don’t understand it because I can modify the existing text, but I can’t replace it with my own words.

    I mean instead of, “Sorry, but nothing matched your search terms. Please try again with some different keywords.”

    “Sorry, I haven’t written anything like that yet. Please send me a message and I’ll answer it for you”.

    If I change the text to something like “orry, but nothg atched your search terms. Please try again with sooooome differen kewords.”

    It’s fine!?

    It makes NO sense to me at all.

    Thank you very much for answering me.
    Craig

    <?php
    /**
     * The template part for displaying a message that posts cannot be found.
     *
     * Learn more: https://codex.www.ads-software.com/Template_Hierarchy
     *
     * @package Sixhours
     * @since Sixhours 1.0
     */
    ?>
    
    <article id="post-0" class="post no-results not-found">
    	<header class="entry-header">
    		<h1 class="entry-title"><?php _e( 'Nothing Found', 'sixhours' ); ?></h1>
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    		<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
    
    			<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'sixhours' ), admin_url( 'post-new.php' ) ); ?></p>
    
    		<?php elseif ( is_search() ) : ?>
    
    			<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'sixhours' ); ?></p>
    			<?php get_search_form(); ?>
    
    		<?php else : ?>
    
    			<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'sixhours' ); ?></p>
    			<?php get_search_form(); ?>
    
    		<?php endif; ?>
    	</div><!-- .entry-content -->
    </article><!-- #post-0 .post .no-results .not-found -->

    It’s because of not escaped single-quotes.
    <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'sixhours' ); ?></p>

    make it

    <p><?php _e( 'Sorry, I haven\'t written anything like that yet. Please send me a message and I\'ll answer it for you.', 'sixhours' ); ?></p>

    notice backslashes right in front of single-quote characters.
    Alternatively, you can write it this way:

    <p><?php _e( "Sorry, I haven't written anything like that yet. Please send me a message and I'll answer it for you.", 'sixhours' ); ?></p>

    so you replace the opening and closing single quote with double-quotes

    Thread Starter ewcadmin

    (@ewcadmin)

    Ohh, thank you very much!

    I don’t know anything about PHP, I’ve heard of things being “escaped” but I don’t know what it means.

    The code you supplied, showed up the back slashes, so I took them out but left all of the single quote/apostrophe unicode in.

    Works a treat now.

    Thinking about it, the problem must have been in the “I’m”.

    I should have written the punctuation in unicode.

    I think anyway: that’s what’s working now.

    Would you know how I could insert my link to my comments page??

    https://www.english-with-craig.co.uk/contactform.html

    Thank you for you help.
    Craig

    Thread Starter ewcadmin

    (@ewcadmin)

    “thank you for your help”

    either way, the most important is that you got it working now.

    Thread Starter ewcadmin

    (@ewcadmin)

    Yes, thank you for your help; I really appreciate it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to change the no-results.php text’ is closed to new replies.