Skip to content

Instantly share code, notes, and snippets.

View mahamudul310's full-sized avatar

Mahamudul mahamudul310

  • INFOSYSTEM DEVELOPMENT LTD.
  • 4/A, Indira Road, Mahbub Plaza 6th Floor Farm gate, Tejgoan , Dhaka-1215
View GitHub Profile
@mahamudul310
mahamudul310 / gist:86eece7b48d27e59655f510d1ff7554d
Created March 24, 2018 05:56
Universal Post Query For Wordpress
<?php
global $post;
$args = array( 'posts_per_page' => 4, 'post_type'=> 'post-type' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$custom_field = get_post_meta($post->ID, 'custom_field', true);
?>
@mahamudul310
mahamudul310 / Enable Masonry
Created March 24, 2018 06:03
Enable Masonry
add_action( 'wp_enqueue_scripts', 'jk_masonry' );
function jk_masonry() {
wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) );
}
/*
How to use?
$('#container').masonry({ singleMode: true });
@mahamudul310
mahamudul310 / codester_framework_theme_option.php
Created March 27, 2018 10:48
How to normally work Codester framework theme_option_chetsheet
<?php
if( !defined('ABSPATH') ) die;
add_filter( 'cs_framework_settings', 'meteor_theme_options_settings' );
function meteor_theme_options_settings($settings) {
$settings = array(
'menu_title' => 'Theme Options',
'menu_type' => 'menu', // menu, submenu, options, theme, etc.
@mahamudul310
mahamudul310 / functions.php
Created March 27, 2018 10:52
how to work in register_post_type in wordpress
<?php
if(! function_exists('hasan_initilize')){
add_action('after_setup_theme','hasan_initilize');
function hasan_initilize(){
register_nav_menus( array(
'primary_menu' => __('Header Menu','hasan')
));
}
@mahamudul310
mahamudul310 / cheatsheet.php
Created March 27, 2018 11:37
WordPress cheat sheet.
<?php wp_head(); ?> //Add end of header section.
<?php wp_footer(); ?> //Add end of footer section.
// Include style and escript in wordpress
<?php
if(! function_exists('hasan_theme_scripts')){
add_action('wp_enqueue_scripts','hasan_theme_scripts');
function hasan_theme_scripts(){
wp_enqueue_style('bootstrap', get_template_directory_uri().'/css/bootstrap.min.css', array(),'1.0.0','all');
@mahamudul310
mahamudul310 / admin.php
Created March 27, 2018 18:16
Admin Menu ordering in WordPress Theme
2 = Dashboard
4 = Separator
5 = Posts
10 = Media
15 = Link
20 = Pages
25 = Comments
59 = Seperator
60 = Appearance
65 = Plugins
@mahamudul310
mahamudul310 / navigation.php
Last active April 8, 2018 10:51
How to Register Navigation Menu in WordPress.
<?php
function hasan_inilize(){
register_nav_menus( array(
'primary_menu' => __('Header','hasan')
));
add_theme_support( 'post-thumbnails' );
}
add_action('after_setup_theme','hasan_inilize' );
?>
@mahamudul310
mahamudul310 / gist:17d2a6fee4882e07af17d70cf3032ea1
Last active October 18, 2018 10:59
OOP Database Connection
<?php
class Student {
// public function __construct() {
//
// }
public function save_student_info($data){
$host_name='localhost';
$user_name='root';
$password ='';
@mahamudul310
mahamudul310 / image_upload.php
Created October 18, 2018 10:58
How to upload image in oop
=============================FONTEND FORM===============================
<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
<input type="file" name="image" accept="image/*" multiple />
===========================BACKEND================================
if(isset($_POST['save'])){
$message = $blog->save_image_info($_POST);
}
$query_result = $blog->selectAllimageinfo();
============================FUNCTION======================================
public function save_image_info() {
@mahamudul310
mahamudul310 / form.php
Created October 21, 2018 19:02
LARAVEL Input Form
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please Sign In</h3>
</div>
<div class="panel-body">
{!! Form::open(['url'=>'/login','method'=>'POST'])!!}
<fieldset>