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
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;
}
@shaddam
shaddam / how to add class in wp menu anchor
Created September 18, 2019 05:44
how to add class in wp menu anchor
function nav_menu_class( $atts ){
$atts['class'] = "your-class";
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'nav_menu_class', 100, 1 );
@shaddam
shaddam / cross-origin request blocked
Last active May 6, 2019 08:47
cross-origin request blocked
Login to your cpanel and open your .htaccess file then put this code on .htaccess file.
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
@shaddam
shaddam / How to Get Post Type in WordPress for elementor Addons
Created April 18, 2019 04:57
How to Get Post Type in WordPress for elementor Addons
/*
* Get Post Type
* return array
*/
function igroup_get_post_types( $args = [] ) {
$post_type_args = [
'show_in_nav_menus' => true,
];
if ( ! empty( $args['post_type'] ) ) {
@shaddam
shaddam / how to disable wordpress plugin update notification
Created November 16, 2018 05:20
how to disable wordpress plugin update notification
function disable_plugin_updates( $value ) {
unset( $value->response['plugin_folder_name/main_plugin_file.php'] );
return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
example by elementor :
function disable_plugin_updates( $disable_elementor_update ) {
@shaddam
shaddam / Add extra class of owl carousel first and last active item
Created September 13, 2018 05:02
Add extra class of owl carousel first and last active item
@shaddam
shaddam / W3 validation error Fixing javascript attribute and css attribute for wordpress theme
Created September 10, 2018 08:18
W3 Fixing javascript attribute and css attribute for wordpress theme <script type="text/javascript"> and <script type="text/css">
// remove text/javascript and text/css for w3 validate
add_filter('style_loader_tag', 'prefix_remove_type_attr', 10, 2);
add_filter('script_loader_tag', 'prefix_remove_type_attr', 10, 2);
function prefix_remove_type_attr($tag, $handle) {
return preg_replace( "/type=['\"]text\/(javascript|css)['\"]/", '', $tag );
}
@shaddam
shaddam / jquery each method
Created May 7, 2018 04:30
jquery each method
jQuery('.project-filters button').each(function (){
jQuery(this).on("click", function(){
var $active = jQuery(this).attr('class');
if($active == 'commercial is-active'){
jQuery('.view_all_button').css('display','none');
} else {
jQuery('.view_all_button').css('display','block');
}
});
});
@shaddam
shaddam / Multiple slick slider inside Bootstrap 4 Tabs
Created May 6, 2018 03:31
Multiple slick slider inside Bootstrap 4 Tabs
.tab-content{
position: relative;
}
.tab-content>.tab-pane {
display: block;
visibility: hidden;
}
.tab-content>.tab-pane.active {
visibility: visible;
}
@shaddam
shaddam / Smooth scroll for links to another page section
Created April 23, 2018 13:22
Smooth scroll for links to another page section