Skip to content

Instantly share code, notes, and snippets.

View tanjimahmmed's full-sized avatar
🎯
Focusing

Md Tanjim Ahmmed tanjimahmmed

🎯
Focusing
View GitHub Profile
<?php
/**
* Plugin Name: Timer Element Elementor
* Plugin URI:
* Description:
* Version: 1.0
* Author: MD Tanjim
* License: GPLv2 or later
* Text Domain: timerelement
* Domain Path: /languages/
@tanjimahmmed
tanjimahmmed / Piklist Repeat Fun
Created March 29, 2020 15:44
Piklist Repeat Fun
function t_process_section_type($part){
global $post;
if('section'== $post->post_type ){
$section_type = get_post_meta($post->ID, 't_section_type', true);
$sections = array('banner','testimonial','service','newsletter','skill');
foreach($sections as $section){
if("section-{$section}.php"== $part['part'] && $section != $section_type){
return false;
}
}
@tanjimahmmed
tanjimahmmed / Custom post loop with custom fields
Created March 2, 2020 07:33
Custom post loop with custom fields
<?php
global $post;
$args = array( 'posts_per_page' => -1, 'post_type'=> 'posttype', 'orderby' => 'menu_order', 'order' => 'ASC' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$job_link= get_post_meta($post->ID, 'job_instructions', true);
?>
@tanjimahmmed
tanjimahmmed / Register custom post type
Created March 2, 2020 05:01
Register custom post
add_action( 'init', 'my_theme_custom_post' );
function my_theme_custom_post() {
register_post_type( 'cpt',
array(
'labels' => array(
'name' => __( 'CPTs' ),
'singular_name' => __( 'CPT' )
),
'supports' => array('title', 'editor', 'custom-fields', 'thumbnail', 'page-attributes'),
'public' => true
@tanjimahmmed
tanjimahmmed / slug
Last active February 28, 2020 17:22
slug link change
function philosophy_cpt_slug_fix($post_link, $id){
$p = get_post($id);
if(is_object($p) && 'chapter'==get_post_type($id)){
$parent_post_id = get_field('parent_book');
$parent_post = get_post($parent_post_id);
if($parent_post){
$post_link = str_replace("%book%", $parent_post->post_name,$post_link);
}
}
return $post_link;
@tanjimahmmed
tanjimahmmed / user social link
Created February 24, 2020 17:45
for user social link
@tanjimahmmed
tanjimahmmed / attachments.php
Last active February 24, 2020 15:04
attachments plugin method add
<?php
define('ATTACHMENTS_SETTINGS_SCREEN', false);
add_filter('attachments_default_instance', '__return_false');
// field area
function philosophy_attachments($attachments){
// if else
$post_id = null;
if( isset( $_REQUEST['post']) || isset( $_REQUEST['post_ID'] ) ){
$post_id = empty($_REQUEST['post_ID']) ? $_REQUEST['post'] : $_REQUEST['post_ID'];
@tanjimahmmed
tanjimahmmed / navigation.php
Last active February 23, 2020 16:44
navigation area
<a class="header__toggle-menu" href="#0" title="Menu"><span>
<?php _e("Menu", 'philosophy'); ?></span>
</a>
<nav class="header__nav-wrap">
<h2 class="header__nav-heading h6">
<?php _e('Site Navigation', 'philosophy') ?>
</h2>
@tanjimahmmed
tanjimahmmed / featured.php
Created February 22, 2020 18:26
featured area
@tanjimahmmed
tanjimahmmed / function.php
Last active February 26, 2020 01:46
theme support
<?php
require_once(get_theme_file_path("/inc/tgm.php"));
require_once(get_theme_file_path("/inc/attachments.php"));
if (site_url()=="http://127.0.0.1/demo.tanjim.com"){
define("VERSION", time());
}else{
define("VERSION",wp_get_theme()->get("version"));
}