Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

Friday, February 17, 2012

Rename Set Featured Image in Wordpress

Posts in Wordpress can have their own featured image when enabled.
Now, here's a way to modify both the 'Featured Image' title and the 'Set Featured Image' link text.

Just add the follwing code to your theme's functions.php

function customizeFeaturedImageLinkTitle( $content ) {
  return $content = str_replace( __('Set featured image'), __('Set DefaultMessage image'), $content);
}

function customizeFeaturedImageTitle($translated) {
  return str_ireplace('Featured Image', 'DefaultMessage Image', $translated);
}

add_filter('gettext','catalogph_customizeFeaturedImageTitle');
add_filter('ngettext','catalogph_customizeFeaturedImageTitle');

Saturday, October 8, 2011

Redirect to Login Page in Wordpress

Using PHP, you can use the following code to redirect a user to the log-in page before being able to access a page. It will go to the page the user is trying to access once he is logged-in.

<?php auth_redirect() ?>

Some say it doesn't work right for logged-in users.
Better add a checking just to make sure it works all the time:

<?php
  if ( !is_user_logged_in() ) {
    auth_redirect();
  }
?>