Skip to content

Instantly share code, notes, and snippets.

View jayshreehcl's full-sized avatar

Vivek Kumar Poddar jayshreehcl

View GitHub Profile
@jayshreehcl
jayshreehcl / custom default avatar in wordpress for genesis theme users
Created June 10, 2013 02:09
Copy and paste the code provided below to add custom default avatar in wordpress. The code provided below is only for genesis theme users. For ore details please kindly read the article at : http://blogvkp.com/how-to-add-custom-default-avatar
//***Adding Custom Default Avatar In Wordpress**/
add_filter( 'avatar_defaults', 'blogvkp_custom_gravatar' );
function blogvkp_custom_gravatar ($avatar_defaults) {
$myavatar = get_stylesheet_directory_uri() . '/images/custom-gravatar.jpg';
$avatar_defaults[$myavatar] = "Custom Gravatar";
return $avatar_defaults;
}
@jayshreehcl
jayshreehcl / gist:5746147
Created June 10, 2013 02:23
Code provided below helps you to customize default avatar in WordPress. This code is for all non genesis theme users. This means if you have bought any premium theme or have created your own or if you have download it for free for any source then use the snippet provided below. make sure to copy the code at the bottom of your theme's function.ph…
//**Add Custom Default Avatar In Wordpress To Other Common Themes**/
add_filter( 'avatar_defaults', 'blogvkp_custom_gravatar' );
function blogvkp_custom_gravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/custom-gravatar.jpg';
$avatar_defaults[$myavatar] = "Custom Gravatar";
return $avatar_defaults;
}
@jayshreehcl
jayshreehcl / customize genesis post excerpt
Last active December 18, 2015 08:29
If you want to modify the default read more link in genesis theme or its child themes then use this code. Simply copy the exact snippet provided below in your theme's function file. And then finally click on save button.
/** Filter to customize the Read More link*/
function custom_read_more_link() {
return '<a href="' .get_permalink() .'>Continue reading..</a>';// Change Continue reading with you own text
}
@jayshreehcl
jayshreehcl / customize genesis post info
Created June 15, 2013 03:19
Ok if you want to reposition your post info or if you want to customize it then please check the code snippets I have shared below.
//* Modify Post Info In Genesis
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
$post_info = '[post_date] by [post_author_posts_link]';
return $post_info;
}
[post_date] by [post_author_posts_link] [post_comments] [post_edit]
[post_date] and [post_edit]
<?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 )
@jayshreehcl
jayshreehcl / function.php
Created April 2, 2015 14:10
Code snippet to show recent posts from category in wordpress. For more information on how to use it properly and other alternatives please refer to : http://wpvkp.com/show-latest-posts-from-category/
<?php
function cust_post() {
$check = new WP_Query( array( 'category_name' => 'nameit', 'posts_per_page' => 5 ) );
if ( $check->have_posts() ) {
// To enable the theme's default style for list elements
$string .= '<ul class="cust_post widget_recent_entries">';
// Checks if the post is present in the category
while ( $check->have_posts() ) {
@jayshreehcl
jayshreehcl / main.css
Created July 31, 2015 06:21
This is the main stylesheet for the responsive html form I have created. You can check the complete tutorial at http://designvkp.com/create-responsive-forms-using-html-css/
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: 'Nunito', sans-serif;
color: #384047;
background-image: url('pattern.png');
background-position: 0px 0px;
@jayshreehcl
jayshreehcl / form.html
Created July 31, 2015 06:22
This is the form fieldset for the the responsive html and css form I have created at http://designvkp.com/create-responsive-forms-using-html-css/
<form action="takeaction.php" method="post">
<h1>Sifalri 2015</h1>
<fieldset>
<legend><span class="number">1</span>Enter Your Details</legend>
<label for="name">Name:</label>
<input type="text" id="name" name="user_name">
<label for="universityname">University/Collage:</label>