• kristysitarase

    (@kristysitarase)


    Hi
    I am trying to change my text for a press area on our site, my theme is in English but my site is in Swedish
    This coding is in comments.php and is not shown anywhere else in the style sheet or theme.php..

    Have changed as you see below but does not amend on the site, tried writing in English as well and no go:(

    HELP!!

    Do not delete these lines
    	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Please do not load this page directly. Thanks!');
    
    	if ( post_password_required() ) { ?>
    		<p class="nocomments">För att erhålla ett lösenord vänligen kontakta oss: press@cirkusprinsessan.net eller ring Maria Tell Sääv 070-738 40 22.</p>
    	<?php
    		return;
    	}
    ?>
Viewing 8 replies - 1 through 8 (of 8 total)
  • esmi

    (@esmi)

    Try adding:

    function change_protected_text($content) {
    	$content = str_replace(
    	'This post is password protected. To view it please enter your password below:',
    	'ENTER_YOUR_TEXT_HERE',
    	$content);
    	return $content;
    }
    add_filter('the_content','change_protected_text');

    to your theme’s function.php file.

    Thread Starter kristysitarase

    (@kristysitarase)

    Thanks Esmi for the tip …. can you let me know where the best place to put the code in?

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => __('Left Sidebar', 'theme961'),
            'before_widget' => '	<div id="%1$s" class="widget %2$s"><div class="widget-bgr">',
    		'before_title' => '		<div class="title"><div><div><h2>',
            'after_title' => '		</h2></div></div></div>',
    		'after_widget' => '		</div></div>',
    ));
    
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => __('Right Sidebar', 'theme961'),
            'before_widget' => '	<div id="%1$s" class="widget %2$s"><div class="widget-bgr">',
    		'before_title' => '		<div class="title"><div><div><h2>',
            'after_title' => '		</h2></div></div></div>',
    		'after_widget' => '		</div></div>',
    ));
    
    // Search
    	function widget_theme961_search() {
    ?>
    
    	<div class="widget widget_search" id="search">
    		<div class="widget-bgr">
    
    			<div class="title">
    				<div><div><h2><?php _e('Site Search','theme961'); ?></h2></div></div>
    			</div>
    
    			<form method="get" id="searchform" action="<?php bloginfo('home'); ?>">
    				<input type="text" class="text" value="<?php the_search_query(); ?>" name="s" id="s" />&nbsp;<input class="but" type="image" src="<?php bloginfo('stylesheet_directory'); ?>/images/search2.gif" value="submit" />
    			</form>
    
    		</div>
    	</div>
    
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
    	register_sidebar_widget(__('Search'), 'widget_theme961_search');
    ?>
    esmi

    (@esmi)

    Try adding it just after the opening <?php tag at the top of the file.

    Thread Starter kristysitarase

    (@kristysitarase)

    Tried but no luck..:(

    esmi

    (@esmi)

    Remember to press CTRL and F5 simultaneously when viewing the updated page. Or try emptying your browser cache. This should ensure that your web browser fetches a fresh copy of the page rather than serving up an out-dated copy from your own cache.

    Thread Starter kristysitarase

    (@kristysitarase)

    Hi Esmi,

    So appreciate the help… still no luck:( here is the url for what I am trying to change and have just put in some text as test to see if change and has not… should I try putting it elsewhere? Or any other Ideas? Thanks again for your help so far…
    http://cirkusprinsessan.net/?page_id=156

    <?php function change_protected_text($content) {
    	$content = str_replace(
    	'Please contact us at for press access:',
    	'today',
    	$content);
    	return $content;
    }
    add_filter('the_content','change_protected_text');
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => __('Left Sidebar', 'theme961'),
            'before_widget' => '	<div id="%1$s" class="widget %2$s"><div class="widget-bgr">',
    		'before_title' => '		<div class="title"><div><div><h2>',
            'after_title' => '		</h2></div></div></div>',
    		'after_widget' => '		</div></div>',
    ));
    
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => __('Right Sidebar', 'theme961'),
            'before_widget' => '	<div id="%1$s" class="widget %2$s"><div class="widget-bgr">',
    		'before_title' => '		<div class="title"><div><div><h2>',
            'after_title' => '		</h2></div></div></div>',
    		'after_widget' => '		</div></div>',
    ));
    
    // Search
    	function widget_theme961_search() {
    ?>
    
    	<div class="widget widget_search" id="search">
    		<div class="widget-bgr">
    
    			<div class="title">
    				<div><div><h2><?php _e('Site Search','theme961'); ?></h2></div></div>
    			</div>
    
    			<form method="get" id="searchform" action="<?php bloginfo('home'); ?>">
    				<input type="text" class="text" value="<?php the_search_query(); ?>" name="s" id="s" />&nbsp;<input class="but" type="image" src="<?php bloginfo('stylesheet_directory'); ?>/images/search2.gif" value="submit" />
    			</form>
    
    		</div>
    	</div>
    
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
    	register_sidebar_widget(__('Search'), 'widget_theme961_search');
    ?>

    esmi

    (@esmi)

    Check the code I gave up above. You have to enter your text after the text that is normally displayed on a password protected posts in the function.

    Thread Starter kristysitarase

    (@kristysitarase)

    I Esmi I had tried that first! and no luck which is why I tried the other way… sorry have had a lat night last night! must be getting tired!…. still a no go! May have to give up!

    <?php	function change_protected_text($content) {
    	$content = str_replace(
    	'This post is password protected. To view it please enter your password below:',
    	'To obtain a password, please contact us at press@cirkusprinsessan.net or ring Maria Tell Saav 070-738 40 22',
    	$content);
    	return $content;
    }
    add_filter('the_content','change_protected_text');
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How do I change the text in a password protected page?’ is closed to new replies.