London
London

Reputation: 15274

Remove certain links from Meta

How do I remove Log in or Log out and Wordpress.org from my META part of my wordpress blog. I use twenty eleven, if that is relevant. I've tried editing sidebar.php but seems nothing is being changed, I mean this part :

enter image description here

<aside id="meta" class="widget">
                    <h3 class="widget-title"><?php _e( 'Meta', 'twentyeleven' ); ?></h3>
                    <ul>
                        <?php wp_register(); ?>
                        <li><?php wp_loginout(); ?></li>
                        <?php wp_meta(); ?>
                    </ul>
                </aside> 

Tried removing <?php wp_meta(); ?> and/or <li><?php wp_loginout(); ?></li>, nothing happens.

Upvotes: 1

Views: 119

Answers (1)

pat34515
pat34515

Reputation: 1979

Since you asked for a PHP solution...

Put this at the top of sidebar.php:

<?php
function _wpMeta($o){
  $links = 'Log in|Logout|WordPress.org';
  return preg_replace('#<li>.+?('.$links.').+?</li>#','',$o);
}
ob_start("_wpMeta");
?>

And this at the bottom:

<?php ob_end_flush(); ?>

Upvotes: 2

Related Questions