Skip to content

Instantly share code, notes, and snippets.

View salmanbd96's full-sized avatar

salman ahmed salmanbd96

View GitHub Profile
Demo LINK: http://salmancreation.com/rrf/
Code MarkUp Here: Thanks Rasel Ahmed(RRF)
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>RRF Layout Desgin</title>
<meta name="description" content="">
Let's say you wanted to use the post thumbnail feature of WordPress, but had a whole archive of posts that would take too much time to go through. For new posts, you can be specific and use the feature as intended. For old posts, you just want to use the first image it finds in the content for the thumbnail, or a default if none present.
Add this to functions.php or make a functionality plugin:
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
Smooth Scrolling
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
Adding this code to your wordpress theme will dynamically create a title.
<title><?php
if (is_home()) { echo bloginfo('name');
} else if (is_404()) {
echo '404 Not Found';
} else if (is_category()) {
echo 'Category:'; wp_title('');
} else if (is_search()) {
echo 'Search Results';
WordPress is full of some great features, although sometimes you need to add something extra
like the following snippet making WordPress just a little easier to use. This snippet will add a new
custom field select menu to your WordPress post, page listings. The menu will display a list of all custom
fields, just select the field you want to filter by. This snippet is only for the wp-admin however If you wanted to
do any sort of filtering on the front end of your site. View the following snippet that will let you filter by category
using search.
add_filter( 'parse_query', 'ba_admin_posts_filter' );
add_action( 'restrict_manage_posts', 'ba_admin_posts_filter_restrict_manage_posts' );
When adding a featured image to a template, you may want to add a
class to the image tag that is being generated. This extra class will allow you to use CSS to format it better.
if ( has_post_thumbnail() ) {
the_post_thumbnail('medium', array('class' => 'alignleft'));
}
Adding this PHP code to your wordpress theme will display image links for your next and previous posts. Upload images to your theme with the name next.png and prev.png.
<?php
next_post_link( '%link', '<img src="' . get_bloginfo('stylesheet_directory') . '/img/prev.png" />');
?>
<?php
previous_post_link('%link', '<img src="' . get_bloginfo('stylesheet_directory') . '/img/next.png" />' );
?>
@salmanbd96
salmanbd96 / gist:018d1f5b936d28870c04
Created October 23, 2014 07:44
web bdesign & dev code and link
https://docs.google.com/document/d/1cWmbv2S7owAbYK2YWYT8IkMDiGUTjNTrx5CFsFWQ5sM/edit?usp=sharing