All posts by Pramod T P
increase the number of posts in the listing page of admin side – wordpress
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’);
include a module inside a content item – Joomla 1.6
Follow the below given steps to include a module inside the content
1) Create a module from admin side and assign it to a position. let it be “position1”
Extensions->Module Manager ->New
2) Add a new article and include the code “{loadposition position1 }” so as to load the module assigned to that position “position1”
Content->Article Manager->Add New Article
how to add a new position – joomla 1.6
Example : <position>debug</position>
This code to be added within the “<positions>’ tags.
Article name from article id in a module page – Joomla
$dVar=new JConfig();
mysql_connect($dVar->host,$dVar->user,$dVar->password);
mysql_select_db($dVar->db);
$articleResult = mysql_fetch_assoc(mysql_query(“SELECT * FROM “.$dVar->dbprefix.”content WHERE id='”.$_REQUEST[‘id’].”‘ “)) or die(mysql_error());
echo $articleName = $articleResult[‘title’]
?>
How to check frontpage page or not – Joomla
Home page
<?php } else { ?>
Inner Page
<?php }; ?>
How to check home page or not – Joomla
if(JRequest::getVar(‘view’) == ‘featured’ ) :
echo ‘ Home page’;
else :
echo ‘Inner page’;
endif;
?>
How to include a module – Joomla
<jdoc:include type=”modules” name=”POSITION-NAME” />
Example : <jdoc:include type=”modules” name=”position1″ />
The above mentioned code will load all the modules that are assigned to the position “position1”
WordPress query to fetch posts orders by date added as custom field
<?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;
}
?>
How to get the site url – Joomla
<?php echo $this->baseurl ?>
<?php echo JURI::base(); ?>