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
@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;
<?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;
.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
/* 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();
@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
@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 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 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' ),
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 / index-1ljxn_ns.css
Created November 18, 2024 18:24
css-cdn-photo-vkp
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-satura