WordPress protected Pages

The protected post system uses POST so by default, no you can’t. However, here is a bare-bone mechanism that will let you do this. function bypass_protected_post() { if (is_single()) { global $post,$_GET; if (isset($post->post_password)) { $bypasskey = get_post_meta($post->ID, ‘bypasskey’, true); if (isset($_GET[‘bypasskey’]) && $_GET[‘bypasskey’] == $bypasskey) { $post->post_password = null; } } } } add_action(‘wp_head’,’bypass_protected_post’); … Read more

Pagination for Pages and Posts

Post Navigation Here’s the way its done in the Twenty Twelve themes single.php file however it looks like Twenty Fourteen has a better solution which works for pages as well. <nav class=”nav-single”> <h3 class=”assistive-text”><?php _e( ‘Post navigation’, ‘twentytwelve’ ); ?></h3> <span class=”nav-previous”><?php previous_post_link( ‘%link’, ‘<span class=”meta-nav”>’ . _x( ‘&larr;’, ‘Previous post link’, ‘twentytwelve’ ) . … Read more

Too many pages causes WordPress admin to be unusable

Unfortunately the details you’ve provided are a bit limited. For example, what sort of hosting are you on and what sort traffic are you dealing with here? If you have a shared hosting account then you should know that shared hosts provide you with limited cpu and memory resources as it’s shared across multiple hosting … Read more

Relative or Absolute Paths for Flash Video Player Files

When dealing with WordPress and Flash, we have to use always absolute URLs. When embedding, when referencing inside the ActionScript, in XML files and when dealing with Remoting. This way is hassle free. I put my SWFs inside wp-content/swf/ and use the URL http://example.com/wp-content/swf/my-flash.swf. There’s nothing virtual about this, it has to be real.

Create subpage /user/ or /my-profile/ like /author/ with additional query like /user/user123

If I understand you well, you can do that with add_rewrite_rule(); function to map the url to specific query variables. https://codex.wordpress.org/Rewrite_API/add_rewrite_rule function myfunc_rewrite_rules() { add_rewrite_rule(‘user/?([^/]*)’, ‘index.php?pagename=user&username=$matches[1]’, ‘top’); } function myfunc_username_query_vars($vars) { $vars[] = ‘username’; return $vars; } add_action(‘init’, ‘myfunc_rewrite_rules’); //add query vars (username) to wordpress add_filter(‘query_vars’, ‘myfunc_username_query_vars’); function myfunc_display() { $userpage = get_query_var(‘pagename’); $username = … Read more

Show TwentyEleven header image only on home page

To remove the header image of the Twenty Eleven theme on other pages then your homepage, change the following code in header.php (in wp-content/themes/twentyeleven) Before: <?php // Check to see if the header image has been removed $header_image = get_header_image(); if ( ! empty( $header_image ) ) : ?> After: <?php // Check to see … Read more