Skip to content

Instantly share code, notes, and snippets.

View hmbashar's full-sized avatar
🏠
Working from home

Md Abul Bashar hmbashar

🏠
Working from home
View GitHub Profile
// force use of templates from plugin folder
function cpte_force_template( $template )
{
if( is_archive( 'events' ) ) {
$template = WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/archive-events.php';
}
if( is_singular( 'events' ) ) {
$template = WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/single-events.php';
}
<?php
function my_enqueue_stuff() {
if ( is_page( 'landing-page-template-one' ) ) {
/** Call landing-page-template-one enqueue */
} else {
/** Call regular enqueue */
}
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_stuff' );
@hmbashar
hmbashar / changes title placeholder.php
Created August 6, 2019 06:39
How to change custom post title placeholder text
<?php
function social_change_title_text( $title ){
$screen = get_current_screen();
if ( 'movie' == $screen->post_type ) {
$title = 'Enter movie name with release year';
}
@hmbashar
hmbashar / page template for plugin.php
Created August 7, 2019 06:04
plugin_tamplate_add_page_attribute_dropdown
<?php
function plugin_tamplate_add_page_attribute_dropdown( $post_templates, $wp_theme, $post, $post_type ) {
$post_templates['pagetamplate.php'] = __('My Plugin Tamplate');
return $post_templates;
}
add_filter( 'theme_page_templates', 'plugin_tamplate_add_page_attribute_dropdown', 10, 4 );
@hmbashar
hmbashar / custom-control-init.php
Created August 9, 2019 14:33 — forked from iqbalrony/custom-control-init.php
Create Elementor Custom Control.
<?php
namespace ElementorControls;
if (!defined('ABSPATH')) exit; // Exit if accessed directly
class Elementor_Custom_Controls {
public function includes() {
require_once(plugin_dir_path(__FILE__).'inc/elementor/image-selector-control.php');
}
@hmbashar
hmbashar / All Media queries for resolutions.css
Last active August 10, 2019 20:54
All Media queries for resolutions (responsive css)
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}
@hmbashar
hmbashar / google font enqueue.php
Last active September 13, 2019 19:08
google font enqueue for wordpress theme and plugins
<?php
wp_enqueue_style( 'prefix-google-font', finestudio_get_google_font_url() );
// Table Hover System
// for 2nd column
$('.hosting-feature-list-row div:nth-child(3)').hover(function() {
$('.hosting-feature-list-row').children('.hosting-feature-list-row div:nth-child(3)').addClass('shape-hosting-pack-hover');
},
function() {
$('.hosting-feature-list-row').children('.hosting-feature-list-row div:nth-child(3)').removeClass('shape-hosting-pack-hover');
}
);