Add the below given code in “functions.php” of the curren template folder
add_filter(‘login_errors’,create_function(‘$a’, “return null;”));
Wordpress
Add the below given code in “functions.php” of the curren template folder
add_filter(‘login_errors’,create_function(‘$a’, “return null;”));
Add the below given code in your .htaccess file
RedirectMatch 301 ^/category/(.+)$ http://www.askapache.com/$1 #
OR
RewriteRule ^category/(.+)$ http://www.askapache.com/$1 [R=301,L]
2) Edit/Add the page to be blocked
4) set a Custom Field of “block” and set the value to “true”.
global $wp_rewrite;
$pagestruct = $wp_rewrite->get_page_permastruct();
$gdPermalink = ” != $pagestruct ?”Yes”:”No”;
function getCurrentCatID(){
global $wp_query;
if(is_category() || is_single()){
$cat_ID = get_query_var(‘cat’);
}
return $cat_ID;
}
Call the function “get_category() ” to fetch the current category details
$category = get_category( getCurrentCatID() );//
$parentID = $cat->category_parent;
echo $parentID;
function adminPaginationLimit(){
global $per_page, $wp_query;
$per_page = 500;
$posts_per_page = 500;
$wp_query->query(‘showposts=’. $posts_per_page);
}
add_action(‘admin_head’, ‘adminPaginationLimit’);
<?php
$postQuery = “SELECT distinct(wposts.post_title),cast(wpostmeta.meta_key as DATE),wposts.ID,wposts.post_content,wposts.post_date,wposts.comment_count
FROM $wpdb->posts wposts
LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
LEFT JOIN $wpdb->postmeta AS wpostmeta ON wposts.ID = wpostmeta.post_id
WHERE wpostmeta.meta_key = ‘dvd_release_date’ AND $wpdb->term_taxonomy.taxonomy = ‘category’ AND $wpdb->term_taxonomy.term_id IN(‘3952’)
ORDER BY wpostmeta.meta_value DESC LIMIT $itemPerPage”;
$postResults = $wpdb->get_results($postQuery, OBJECT);
foreach( $postResults as $post ) {
echo $post->post_title;
}
?>
<?php query_posts(array(‘category__and’ => array(22,27))); ?>
Create folder in wp-content/plugins/ and give a relevant name . let it be “wpcRecentPosts”.
Inside that folder create a file “wpcRecentPosts.php “ and paste the below given code in that file .
<?php
/**
* Plugin Name: WPC Recent Posts With Pagination
* Plugin URI: http://phpcodez.com/
* Description: A widget that displays Recent Posts With Pagination
* Version: 0.1
* Author: Pramod T P
* Author URI: http://phpcodez.com/
*/
add_action( ‘widgets_init’, ‘wpc_recentposts_widgets’ );
function wpc_recentposts_widgets() {
register_widget( ‘wpcrecentpostsWidget’ );
}
class wpcrecentpostsWidget extends WP_Widget {
function wpcrecentpostsWidget() {
$widget_ops = array( ‘classname’ => ‘wpcClass’, ‘description’ => __(‘A widget that displays Recent Posts With Pagination.’, ‘wpcClass’) );
$control_ops = array( ‘width’ => 300, ‘height’ => 350, ‘id_base’ => ‘wpc-recentposts’ );
$this->WP_Widget( ‘wpc-recentposts’, __(‘Recent Posts With Pagination’, ”), $widget_ops, $control_ops );
}
function widget( $args, $instance ) { ?>
<script type=”text/javascript”>
function getNextPosts(pageno){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
alert (“Your browser does not support AJAX!”);
return;
}
var url=”<?php echo WP_PLUGIN_URL ?>/wpcRecentPosts/”+”recent-posts.php?”;
url=url+”&page_no=”+pageno;
url=url+”&sid=”+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChangedFeaturedMovies;
xmlHttp.open(“GET”,url,true);
xmlHttp.send(null);
}
function stateChangedFeaturedMovies(){
if (xmlHttp.readyState==4)
document.getElementById(“recentPost”).innerHTML=xmlHttp.responseText;
}
if(!window.GetXmlHttpObject) {
function GetXmlHttpObject(){
var xmlHttp=null;
try {// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e) {// Internet Explorer
try {
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”);
}
catch (e){
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
}
return xmlHttp;
}
}
</script>
<div id=”recentPost”>
<?php
global $wpdb;
$itemPerPage=3;
$recentPostQuery = “SELECT distinct(post_title) ,ID,post_title FROM $wpdb->posts WHERE post_type=’post’ AND post_status=’publish’ “;
$recentPostCount = $wpdb->get_results($recentPostQuery, OBJECT);
$totalrecentPost = sizeof($recentPostCount);
$lastPage=ceil($totalrecentPost/$itemPerPage);
?>
<table>
<tr>
<td width=”50%”><a href=”javascript:getNextPosts(2);”>Next</a></td>
<td><a href=”javascript:getNextPosts(<?php echo $lastPage; ?>);”>Previous</a></td>
</tr>
<?php
$recentPostQuery=$recentPostQuery . ” ORDER BY post_date DESC LIMIT $itemPerPage” ;
$recentPostResults = $wpdb->get_results($recentPostQuery, OBJECT);
foreach( $recentPostResults as $recentPost ) {
?>
<tr><td colspan=”2″><a href=”<?php echo get_permalink($recentPost->ID) ?>”> <?php echo $recentPost->post_title; ?></a></td></tr>
<?php } ?>
</table>
</div>
<?php
}
function update( $new_instance, $old_instance ) {}
function form( $instance ) {echo “No Backend Options Available”;}
}
?>
After that create a file that run behind the scene when we call a javascript function and here we use “recent-posts.php”. Paste the below given code in that file
<?php
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.’..’.DIRECTORY_SEPARATOR.’..’.DIRECTORY_SEPARATOR.’..’.DIRECTORY_SEPARATOR.’wp-load.php’);
$pageNo=$_REQUEST[‘page_no’];
global $wpdb;
$itemPerPage=3;
$recentPostQuery = “SELECT distinct(post_title) ,ID,post_title FROM $wpdb->posts WHERE post_type=’post’ AND post_status=’publish’ “;
$recentPostCount = $wpdb->get_results($recentPostQuery, OBJECT);
$totalrecentPost = sizeof($recentPostCount);
$lastPage = ceil($totalrecentPost/$itemPerPage);
$start = ($pageNo-1)*$itemPerPage;
if($lastPage<$pageNo){ $start=0;$pageNo=1;}
if($totalrecentPost<$start){ $start=0;$pageNo=1; }
if($start<0){$pageNo=$lastPage;$start= ($lastPage-1)*$itemPerPage;}
?>
<table>
<tr>
<td width=”50%”><a href=”javascript:getNextPosts(<?php echo $pageNo+1 ?>);”>Next</a></td>
<td><a href=”javascript:getNextPosts(<?php echo $pageNo-1 ?>);”>Previous</a></td>
</tr>
<?php
$recentPostQuery=$recentPostQuery . ” ORDER BY post_date DESC LIMIT $start,$itemPerPage” ;
$recentPostResults = $wpdb->get_results($recentPostQuery, OBJECT);
foreach( $recentPostResults as $recentPost ) {
?>
<tr><td colspan=”2″><a href=”<?php echo get_permalink($recentPost->ID) ?>”> <?php echo $recentPost->post_title; ?></a></td></tr>
<?php } ?>
</table>