Skip to content

Instantly share code, notes, and snippets.

@sudipbd
sudipbd / functions.php
Created November 19, 2016 08:18
WordPress Read More to excerpt
<?php
function wpdocs_excerpt_more( $more ) {
return sprintf( '<a class="read-more" href="%1$s">%2$s</a>',
get_permalink( get_the_ID() ),
__( ' Read More...', 'textdomain' )
);
}
add_filter( 'excerpt_more', 'wpdocs_excerpt_more' );
?>
@sudipbd
sudipbd / index.php
Created November 19, 2016 08:19
WordPress normal pagination
//on index.php right after endwhile
<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
<?php else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
@sudipbd
sudipbd / functions.php
Created November 19, 2016 08:22
WordPress numeric pagination
<?php
function ct_paging_nav() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
@sudipbd
sudipbd / functions.php
Created November 19, 2016 08:23
WordPress widget default category text change
<?php
function ChangeSelectTitle($cat_args){
$cat_args['show_option_none'] = __('USA Poker Rooms');
return $cat_args;
}
add_filter('widget_categories_dropdown_args', 'ChangeSelectTitle');
?>
@sudipbd
sudipbd / functions.php
Created November 19, 2016 08:26
WordPress Option Tree setup for theme option
<?php
//option tree setup for theme option
//first download option tree plugin from wordpress.org then paste the folder in theme directory.
//copy 2 files “theme-options.php” and “meta-boxes.php” to inc folder then include.
add_filter( 'ot_show_pages', '__return_false' );
add_filter( 'ot_show_new_layout', '__return_false' );
add_filter( 'ot_theme_mode', '__return_true' );
include_once( 'option-tree/ot-loader.php' );
include_once( 'inc/theme-options.php' );
@sudipbd
sudipbd / functions.php
Last active November 19, 2016 08:30
WordPress body class for device(s) and browser(s) and platform(s)
<?php
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
@sudipbd
sudipbd / style.css
Created November 19, 2016 08:45
WordPress theme basic info
/*
Theme Name: Twenty Sixteen
Theme URI: https://wordpress.org/themes/twentysixteen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Sixteen is a modernized take on an ever-popular WordPress layout — the horizontal masthead with an optional right sidebar that works perfectly for blogs and websites. It has custom color options with beautiful default color schemes, a harmonious fluid grid using a mobile-first approach, and impeccable polish in every detail. Twenty Sixteen will make your WordPress look beautiful everywhere.
Version: 1.3
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: one-column, two-columns, right-sidebar, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, flexible-header, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready, blog
@sudipbd
sudipbd / index.html
Created November 22, 2016 05:32
Owl Carousel with progress and navigation icons
<div class="slider">
<div class="container-fluid no-padding no-margin">
<div class="row">
<div class="col-md-12">
<div id="slider-items" class="owl-carousel owl-theme">
<div class="item">
<img src="img/fullimage1.jpg" alt="The Last of us">
<p class="caption">Beautiful Bangladesh</p>
</div>
<div class="item">
@sudipbd
sudipbd / index.php
Created November 25, 2016 16:48
WordPress image URL
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
$thumb_url = $thumb_url_array[0];
?>
<?php echo $thumb_url; ?>
@sudipbd
sudipbd / functions.php
Last active December 11, 2016 08:00
WordPress jQuery
wp_enqueue_script('jquery');