Ultimae Branding Plugin Problem - In the text Domain

I am trying to change the default text "Sorry, but nothing matched your search criteria." for search results JUST for one category result and not universally.

In "This Text Domain" I have added: /category/serial-numbers

And then "And Replace It With" with the text: You must be a member of an Angel Token page to see a link to your membership here.

This is for this page: http://www.taggedbyanangel.com/category/serial-numbers/

When I click on Serial Numbers and am not logged in. It does not apply.

If I leave "In this text domain" then it applies to all search results and that I DO NOT WANT.

See example screen cast: http://www.screencast.com/t/0kHBnqWJK

Please advise.

  • Kasia Swiderska

    Hello David,

    If I leave "In this text domain" then it applies to all search results and that I DO NOT WANT.

    That is correct behaviour. Text change module works on every instance of text you want to replace, it will change it all.
    Text domain might narrow it to plugin or theme - text domain is not for actual domain. Please see here what text domain is https://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains

    You will need to modify your category template in theme. There is probably code for that text string in archive.php or category.php so you will need to wrap it with IF ELSE statement with conditional https://codex.wordpress.org/Conditional_Tags#A_Category_Page like that

    if ( is_category( 9 ) ) {
    echo "You must be a member of an Angel Token page to see a link to your membership here.";
    } else {
    "Sorry, but nothing matched your search criteria.";
    }

    of course 9 should be your category ID.

    kind regards,
    Kasia

  • David

    HI

    Q: are you relaying back to me that the Ultimate Branding plugin cannot affect text specific to a singular post category search results page?

    To be clear. I want to change the text on a particular post category results page. In this case, Serial Number category has the status bar result that includes "?taxonomy-category&tag_ID=232?"

    Is this the category ID, 232?

    If so are you recommending I create an MU plugin with the code provided? If not what am I supposed to do with the code provided?

    Please advise. I'm a bit confused as to what you are recommending.

  • Nithin

    Hi David,

    Hope you are doing good today.

    Q: are you relaying back to me that the Ultimate Branding plugin cannot affect text specific to a singular post category search results page?

    Ultimate Branding plugin will only allow you to change the text globally, or specific to a text domain. Textdomain is a slug of a plugin/theme which is an unique identifier, and ultimate branding plugin will change/replace the text according to that specific textdomain. A plugin/theme will only have one unique textdomain. For Membership Pro plugin, the texdomain will be membership2.

    I'm afraid, you cannot change texts according to each category. For that, as mentioned by Kaisa, you'll have to edit your themes template file. Depending upon your premium theme, it would be either archive.php, or category.php, or some other file where the text Sorry, but nothing matched your search criteria resides. You'll have to find the template file in your theme, and wrap the line/code Sorry, but nothing matched your search criteria. with an if else statement, as shown above.

    if ( is_category( 232 ) ) {
    echo "You must be a member of an Angel Token page to see a link to your membership here.";
    } else {
    "Sorry, but nothing matched your search criteria.";
    }

    The above code is just an example, you'll have to base it according to how your theme outputs your string.

    I hope this helps. Please let us know how that goes, so that we could give a closer look, if needed. Have a nice day.

    Kind Regards,
    Nithin

  • David

    I heard back from the theme developer and this is what they suggested:

    This issue requires advanced customization, but we could recommend you to edit

    \wp-content\themes\organics\templates\no-search.php file from line 30.

    This is the code from this file:

    <?php
    
    // Disable direct call
    if ( ! defined( 'ABSPATH' ) ) { exit; }
    
    /* Theme setup section
    -------------------------------------------------------------------- */
    
    if ( !function_exists( 'organics_template_no_search_theme_setup' ) ) {
    	add_action( 'organics_action_before_init_theme', 'organics_template_no_search_theme_setup', 1 );
    	function organics_template_no_search_theme_setup() {
    		organics_add_template(array(
    			'layout' => 'no-search',
    			'mode'   => 'internal',
    			'title'  => esc_html__('No search results found', 'organics'),
    			'w'		 => null,
    			'h'		 => null
    		));
    	}
    }
    
    // Template output
    if ( !function_exists( 'organics_template_no_search_output' ) ) {
    	function organics_template_no_search_output($post_options, $post_data) {
            global $ORGANICS_GLOBALS;
    		?>
    		<article class="post_item">
    			<div class="post_content">
    				<h2 class="post_title"><?php echo sprintf(esc_html__('Search: %s', 'organics'), get_search_query()); ?></h2>
    				<p><?php esc_html_e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'organics' ); ?></p>
    				<p><?php echo wp_kses( sprintf(__('Go back, or return to <a href="%s">%s</a> home page to choose a new page.', 'organics'), home_url(), get_bloginfo()), $ORGANICS_GLOBALS['allowed_tags'] ); ?>
    				<br><?php esc_html_e('Please report any broken links to our team.', 'organics'); ?></p>
    				<?php echo trim(organics_sc_search(array('state'=>"fixed"))); ?>
    			</div>	<!-- /.post_content -->
    		</article>	<!-- /.post_item -->
    		<?php
    	}
    }
    ?>

    QUESTION: where would I insert your code provided into this code above?

    if ( is_category( 232 ) ) {
    echo "You must be a member of an Angel Token page to see a link to your membership here.";
    } else {
    "Sorry, but nothing matched your search criteria.";
    }
  • Kasia Swiderska

    Hello David,

    I'm actually not sure if that is right template you got from theme developers. That looks like search results and we want piece that shows when there are no posts to show in category.
    But I don't know that theme and I might be wrong, so you can try replacing this line

    <p><?php esc_html_e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'organics' ); ?></p>

    with

    <?php if ( is_category( 232 ) ) { ?>
    		<p><?php esc_html_e( 'You must be a member of an Angel Token page to see a link to your membership here.', 'organics' ); ?></p>
    <?php } else { ?>
    		<p><?php esc_html_e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'organics' ); ?></p>
    <?php } ?>

    Let me know if this will work.

    kind regards,
    Kasia