Skip to content

Instantly share code, notes, and snippets.

View shaddam's full-sized avatar

Md Shaddam Hossain shaddam

  • Faridpur, Pabna, Bangladesh
View GitHub Profile
@shaddam
shaddam / How to creating WordPress breadcrumbs without any plugin
Last active April 28, 2020 06:57
How to creating WordPress breadcrumbs without any plugin
<?php
/**
* This partial is used for displaying the Breadcrumbs
*
* @package draw
*
* Add this to any template file by calling draw_breadcrumbs()
*/
/**
@shaddam
shaddam / Email to friend Button for WordPress
Created April 22, 2020 05:31
Email to friend Button for WordPress
<a href="mailto:?subject=<?php the_title();
?>&amp;body=<?php the_permalink() ?>" title="Send this
link to a friend!">Email this</a>
@shaddam
shaddam / Custom Post Type Single Templates from Plugin Folder
Created April 18, 2020 11:34
Custom Post Type Single Templates from Plugin Folder
/* Draw Constructions single service template */
function draw_cons_single_template_modify($single) {
global $post;
/* Checks for single template by post type */
if ( $post->post_type == 'draw_cons_service' ) {
if ( file_exists( DRAW_CON_PL_PATH . '/single-draw_cons_service.php' ) ) {
return DRAW_CON_PL_PATH . '/single-draw_cons_service.php';
}
@shaddam
shaddam / How to add pagination in a Wordpress Custom Post Type Query
Last active April 15, 2020 11:33
How to add pagination in a Wordpress Custom Post Type Query
// WP Query
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => !empty( $settings['grid_post_type'] ) ? $settings['grid_post_type'] : 'post',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'posts_per_page' => !empty( $settings['post_limit'] ) ? $settings['post_limit'] : 3,
'order' => $postorder,
'paged' => $paged,
@shaddam
shaddam / how to add custom icom in elementor
Created April 15, 2020 06:20
how to add custom icom in elementor
<?php
namespace DrawCon;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Draw_Con_Icon_Manager{
private static $instance = null;
@shaddam
shaddam / How to get Contact form 7 list for elementor addons
Created November 18, 2019 04:09
How to get Contact form 7 list for elementor addons
/*
* Contact form list
* return array
*/
function themename_contact_form_seven(){
$countactform = array();
$themename_forms_args = array( 'posts_per_page' => -1, 'post_type'=> 'wpcf7_contact_form' );
$themename_forms = get_posts( $themename_forms_args );
if( $themename_forms ){
@shaddam
shaddam / Get Post Type List in WP for elementor addons
Created November 18, 2019 03:46
Get Post Type List in WP for elementor addons
/*
* Get Post Type
* return array
*/
function themename_get_post_types( $args = [] ) {
$post_type_args = [
'show_in_nav_menus' => true,
];
if ( ! empty( $args['post_type'] ) ) {
@shaddam
shaddam / Get Taxonomy List in WP for elementor addons
Created November 18, 2019 03:43
Get Taxonomy List in WP for elementor addons
/*
* Get Taxonomy
* return array
*/
function themename_get_taxonomies( $themename_texonomy = 'category' ){
$terms = get_terms( array(
'taxonomy' => $themename_texonomy,
'hide_empty' => true,
));
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
@shaddam
shaddam / Insert template list in elementor addons
Last active October 15, 2019 03:22
Insert template list in elementor addons
/* paste this code function file
* Elementor Templates List
* return array
*/
function brenda_elementor_template() {
$templates = \Elementor\Plugin::instance()->templates_manager->get_source( 'local' )->get_items();
$types = array();
if ( empty( $templates ) ) {
$template_lists = [ '0' => __( 'Do not Saved Templates.', 'brenda' ) ];
} else {
@shaddam
shaddam / add nav menu list in elementor widget
Created September 18, 2019 08:56
add nav menu list in elementor widget
this code for function file
// select nav menu list
function select_nav_menu(){
$menus = wp_get_nav_menus();
$menulists = [];
foreach( $menus as $menu ){
$menulists[ $menu->slug ] = $menu->name;
}