/i', $post->post_content, $matches);
if (isset($matches [1] [0])) {
$img_source = $matches [1] [0];
}
if($img_source){
$img_path = regalway_image_resize($img_source, $w, $h);
if (!empty($img_path['url'])) {
print "";
}
}
}
/**
* This function thumbnail id and
* returns thumbnail image
* @param type $iw
* @param type $ih
*/
function indreams_get_thumbnail($iw, $ih) {
$id="";
$permalink = get_permalink($id);
$thumb = get_post_thumbnail_id();
if($thumb){
$image = indreams_thumbnail_resize($thumb, '', $iw, $ih, true, 90);
if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) {
print "";
}
}
}
function indreams_widgets_init() {
// Area 1, located at the top of the sidebar.
register_sidebar(array(
'name' => 'My First Widget',
'id' => 'primary-widget-area',
'description' => 'My First Widget',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
));
// Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
register_sidebar(array(
'name' => 'My Second Widget',
'id' => 'secondary-widget-area',
'description' => 'My second widget',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
));
// Area 3, located in the footer. Empty by default.
register_sidebar(array(
'name' => INDREAMS_FIRST_FOOTER_WIDGET,
'id' => 'first-footer-widget-area',
'description' => INDREAMS_THE_FIRST_FOOTER_WIDGET,
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
// Area 4, located in the footer. Empty by default.
register_sidebar(array(
'name' => INDREAMS_SECONDRY_FOOTER_WIDGET,
'id' => 'second-footer-widget-area',
'description' => INDREAMS_THE_SECONDRY_FOOTER_WIDGET,
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
// Area 5, located in the footer. Empty by default.
register_sidebar(array(
'name' => INDREAMS_THIRD_FOOTER_WIDGET,
'id' => 'third-footer-widget-area',
'description' => INDREAMS_THE_THIRD_FOOTER_WIDGET,
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
// Area 6, located in the footer. Empty by default.
register_sidebar(array(
'name' => INDREAMS_FOURTH_FOOTER_WIDGET,
'id' => 'fourth-footer-widget-area',
'description' => INDREAMS_THE_FOURTH_FOOTER_WIDGET,
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
}
/** Register sidebars by running indreams_widgets_init() on the widgets_init hook. */
add_action('widgets_init', 'indreams_widgets_init');
/**
* Pagination for blog page
*
*/
function indreams_numeric_posts_nav() {
if( is_singular() )
return;
global $wp_query;
/** Stop execution if there's only 1 page */
if( $wp_query->max_num_pages <= 1 )
return;
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = intval( $wp_query->max_num_pages );
/** Add current page to the array */
if ( $paged >= 1 )
$links[] = $paged;
/** Add the pages around the current page to the array */
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '
' . "\n";
/** Previous Post Link */
if ( get_previous_posts_link() )
printf( '
%s
' . "\n", get_previous_posts_link() );
/** Link to first page, plus ellipses if necessary */
if ( ! in_array( 1, $links ) ) {
$class = 1 == $paged ? ' class="active"' : '';
printf( '
';
}
/** Link to current page, plus 2 pages in either direction if necessary */
sort( $links );
foreach ( (array) $links as $link ) {
$class = $paged == $link ? ' class="active"' : '';
printf( '