Skip to content

Instantly share code, notes, and snippets.

View vivek-kumar-poddar's full-sized avatar

Vivek Kumar Poddar vivek-kumar-poddar

View GitHub Profile
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<aside id="secondary" class="widget-area">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</aside><!-- #secondary -->
@vivek-kumar-poddar
vivek-kumar-poddar / functions.php
Created September 2, 2017 15:40
This code snippet will help you to register a new widget in wordpress. For more details please visit: https://wpvkp.com/create-new-widget-area-in-wordpress
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function bb_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'bb' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'bb' ),
@vivek-kumar-poddar
vivek-kumar-poddar / functions.php
Created August 25, 2017 16:11
https://wpvkp.com/enable-dns-prefetch-wordpress-instant-articles-plugin -- This code will help you to enable dns prefetch in wordpress.
<?php // ************* DON'T COPY ME ***************
/* This is for next and previous post */
function wpvkp_dnsprefetch_next_previous() {
$nxt = get_next_post();
$prv = get_previous_post();
if ( !empty( $nxt ) ) {
echo '<link rel="prefetch" href="'.get_permalink( $nxt-&gt;ID ).'" />
@vivek-kumar-poddar
vivek-kumar-poddar / functions.php
Created August 25, 2017 16:09
https://wpvkp.com/enable-dns-prefetch-wordpress-instant-articles-plugin -- This code will help you to enable dns prefetch in wordpress.
<?php // ************* DON'T COPY ME ***************
/* This is for homepage */
function wpvkp_dnsprefetch_homepage() {
$homepage = get_home_url();
if ( !empty( $homepage ) ) {
echo '<link rel="prefetch" href="'.$homepage.'">
<link rel="prerender" href="'.$homepage.'">';
}
}
@vivek-kumar-poddar
vivek-kumar-poddar / functions.php
Created August 23, 2017 17:15
This is an updated version of social media buttons. This code snippet will help you to add social media buttons to your website without even using any plugin. Furthermore it's javascript free. Enjoy fast speed and the same usability. For more details visit the official post: https://wpvkp.com/add-social-media-sharing-buttons-to-wordpress-without…
// Function to handle the thumbnail request
function get_the_post_thumbnail_src($img)
{
return (preg_match('~\bsrc="([^"]++)"~', $img, $matches)) ? $matches[1] : '';
}
function wpvkp_social_buttons($content) {
global $post;
if(is_singular() || is_home()){
// Get current page URL
<?php
/* Please don't copy the opening <?php tag */
function blogprime_homepage_dns_prefetch() {
/* variable for storing the homepage url */
$homepage = get_home_url();
/* variable for storing the next post url */
$next_post = get_next_post();
/* variable for storing the previous post url */
$prev_post = get_previous_post();
.animated{-webkit-animation-duration:.5s;-moz-animation-duration:.5s;-o-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;-moz-animation-fill-mode:both;-o-animation-fill-mode:both;animation-fill-mode:both}@-webkit-keyframes slideDown{0%{-webkit-transform:translateY(-100%)}100%{-webkit-transform:translateY(0)}}@-moz-keyframes slideDown{0%{-moz-transform:translateY(-100%)}100%{-moz-transform:translateY(0)}}@-o-keyframes slideDown{0%{-o-transform:translateY(-100%)}100%{-o-transform:translateY(0)}}@keyframes slideDown{0%{transform:translateY(-100%)}100%{transform:translateY(0)}}.animated.slideDown{-webkit-animation-name:slideDown;-moz-animation-name:slideDown;-o-animation-name:slideDown;animation-name:slideDown}@-webkit-keyframes slideUp{0%{-webkit-transform:translateY(0)}100%{-webkit-transform:translateY(-100%)}}@-moz-keyframes slideUp{0%{-moz-transform:translateY(0)}100%{-moz-transform:translateY(-100%)}}@-o-keyframes slideUp{0%{-o-transform:translateY(0)}100%{-o-transform:translate
<?php
// Add search form to secondary navigation in genesis.
add_filter( 'wp_nav_menu_items', 'g_search_right_nav', 10, 2 );
function g_search_right_nav( $menu, stdClass $args ){
if ( 'secondary' != $args->theme_location )
return $menu;
if( genesis_get_option( 'nav_extras' ) )
return $menu;
@vivek-kumar-poddar
vivek-kumar-poddar / socialbuttons.php
Last active April 27, 2017 00:09
This code snippets allows users to put social media buttons on their posts. This is code snippet for java-script free social media buttons. https://wpvkp.com/add-social-media-sharing-buttons-to-wordpress-without-plugin/
<?php
// Function to handle the thumbnail request
function get_the_post_thumbnail_src($img)
{
return (preg_match('~\bsrc="([^"]++)"~', $img, $matches)) ? $matches[1] : '';
}
function wpvkp_social_buttons($content) {
global $post;