Skip to content

Instantly share code, notes, and snippets.

View asufian97's full-sized avatar
🎯
Focusing

Abu Sufian asufian97

🎯
Focusing
  • front-end/wordpress developer
  • Sylhet,Bangladesh
View GitHub Profile
#<?php language_attributes(); ?> ->this code for add language add in html.
#<?php bloginfo( 'charset' ); ?> ->this code use for meta charset utf.
#please search google for header title dynamic , and also know separetor and left right =><?php wp_title( '|', true, 'right' ); ?>.
#css call for theme and search wp enqueue style or your mind what do.
#how to properly add css in wp theme. ->search google.
@asufian97
asufian97 / custom-post-loop-with-pagination.php
Last active October 13, 2017 09:44
custom-post-loop-with-pagination.php
<?php
global $paged;
$posts_per_page = 9;
$settings = array(
'showposts' => $posts_per_page,
'post_type' => 'portfolio',
'orderby' => 'menu_order',
'order' => 'ASC',
'paged' => $paged)
);
@asufian97
asufian97 / related-posts.php
Created October 13, 2017 09:46
related-posts
@asufian97
asufian97 / homepage-only
Created October 13, 2017 09:47
homepage-only
<?php if( is_home() || is_front_page() ) : ?>
<!-- Homepage Only Code -->
<?php else : ?>
<!-- Other Page Code -->
<?php endif; ?>
@asufian97
asufian97 / custom-post-query
Created October 13, 2017 09:48
custom-post-query
<?php
global $post;
$args = array( 'posts_per_page' => 10, 'post_type'=> 'custom-post-type' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$job_link= get_post_meta($post->ID, 'job_instructions', true);
?>
@asufian97
asufian97 / wordpress-image-crop.php
Created October 13, 2017 09:48
wordpress-image-crop.php
<?php
// in functions.php
add_theme_support( 'post-thumbnails');
/*
Wordpress crop an image = 5 size. Sizes are given below
thumbnail // Thumbnail (default 150px x 150px max)
medium // Medium resolution (default 300px x 300px max)
large // Large resolution (default 640px x 640px max)
full // Original image resolution (unmodified)
But, if you need custom size, you can define sizes in functions.php
@asufian97
asufian97 / add-custom-post-type-menu.php
Created October 24, 2017 14:38 — forked from tommcfarlin/add-custom-post-type-menu.php
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
http://stop-metastasized-cancer-fast.com/
b2bleadarmy.com
http://www.tocpns.co.id/v2/
http://iamsufian.rf.gd/
http://iamsufian.rf.gd/work-example
http://iamsufian.rf.gd/work-example3
http://iamsufian.rf.gd/work-example2/
@asufian97
asufian97 / wordpress cheat
Last active December 9, 2017 12:54
quick wordpress theme develop guide
The beginning: CSS-file (theme details)
/*
Theme Name: Twenty Ten
Theme URI: http://wordpress.org/
Description: The 2010 default theme for WordPress.
Author: wordpressdotorg
Author URI: http://wordpress.org/
Version: 1.0
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)
@asufian97
asufian97 / read more.php
Created November 3, 2017 02:13
wordpress expert post read more
function new_excerpt_more($more) {
return '';
}
add_filter('excerpt_more', 'new_excerpt_more', 21 );
function the_excerpt_more_link( $excerpt ){
$post = get_post();
$excerpt .= '<a href="'. get_permalink($post->ID) . '">Read More </a>.';
return $excerpt;
}