Skip to content

Instantly share code, notes, and snippets.

View aarifhsn's full-sized avatar
🎯
Focusing

Md. Arif Hassan aarifhsn

🎯
Focusing
View GitHub Profile
/**
* Pagination
*/
function WpDevs_pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
<?php if (function_exists("WpDevs_pagination")) {
WpDevs_pagination($wp_query->max_num_pages);
} ?>
/**
* Replaces the excerpt "more" text by a link
*/
function thirteenmag_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full article <i class="fa fa-share"></i> </a>';
}
add_filter('excerpt_more', 'thirteenmag_excerpt_more');
/**
* Register widgetized area and update sidebar with default widgets
*/
function thirteenmag_widget_areas() {
register_sidebar( array(
'name' => __( 'Top Sidebar', 'thirteenmag' ),
'id' => 'right_sidebar',
'before_widget' => '<div class="single_widget fix">',
'after_widget' => '</div>',
<?php dynamic_sidebar('right_sidebar'); ?>
<?php
if ( is_home() ) {
query_posts( 'cat=-3' );
}
?>
<?php
if ( is_home() ) {
query_posts( 'cat=-1,-2,-3' );
}
?>
/**
* Filters wp_title to print a neat <title> tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function WpDevs_wp_title( $title, $sep ) {
if ( is_feed() ) {
return $title;
/**
*Custom Post Types
*/
function wpdevs_custom_post() {
register_post_type( 'news-posts',
array(
'labels' => array(
'name' => __( 'News Posts', 'hellothirteen' ),
<!--NEWS SECTION-->
<?php
global $post;
$args = array ('post_type'=> 'news-posts','posts_per_page' =>3);
$the_query = new WP_Query($args); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>