Skip to content

Instantly share code, notes, and snippets.

View humayunahmed8's full-sized avatar
🤡
code fool

Humayun Ahmed humayunahmed8

🤡
code fool
View GitHub Profile
@humayunahmed8
humayunahmed8 / js-statement.js
Created February 12, 2024 14:13
Javascript Statement
// Javascript Statement
/*
1. A statement is a complete line of code that performs
some action. It may or may not result in a value.
2. Statements typically perform tasks such as variable assignment,
control flow (if statements, loops), function declarations, etc.
*/
@humayunahmed8
humayunahmed8 / google-fonts-wp-theme.php
Created November 29, 2023 19:17
Google fonts Url For WordPress theme
/**
* Google fonts url. Use in function.php file and call with wp_enqueue_style. Exemple
* wp_enqueue_style(theme-name-google-fonts', full_pack_google_fonts_url(), array(), null);
*/
function full_pack_google_fonts_url()
{
$fonts_url = '';
$font_families = array();
@humayunahmed8
humayunahmed8 / wp-default-widget-and-content-style.css
Last active November 10, 2023 22:52
WP Default Widget & Content CSS
/* Post Content Paragraph */
.entry-content p {
margin-bottom: 1rem;
}
/* Post Content Heading */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
@humayunahmed8
humayunahmed8 / allinonemigration.md
Created November 8, 2023 17:04
All-in-One WP Migration - Restore From Server (without PRO version) - Restore

All-in-One WP Migration Restore From Server (without pro version)

If you don't want to pay for the PRO version of this plugin, and you want to use the "Restore from Server" functionally that was present in the version 6.77, follow the instructions below:

  1. Open the js file: wp-content/plugins/all-in-one-wp-migration/lib/view/assets/javascript/backups.min.js
  2. On line 1208, replace the code below:
$('.ai1wm-backup-restore').click(function (e) {
@humayunahmed8
humayunahmed8 / 1.metabox.php
Last active November 6, 2023 08:11
Allowed html tags and class in codestar metabox feild
<?php
function lcorp_section_pricing_metabox( $metaboxes ) {
$section_id = 0;
if ( isset( $_REQUEST['post'] ) || isset( $_REQUEST['post_ID'] ) ) {
$section_id = empty( $_REQUEST['post_ID'] ) ? $_REQUEST['post'] : $_REQUEST['post_ID'];
}
if ( 'section' != get_post_type( $section_id ) ) {
@humayunahmed8
humayunahmed8 / conditional-blog-and-elementor-page.php
Created October 31, 2023 18:02
Show conditional blog single page with elementor
<?php
$elementor_page = false;
if (class_exists('\Elementor\Plugin')) {
$elementor_page = \Elementor\Plugin::$instance->db->is_built_with_elementor(get_the_ID());
}
if ( $elementor_page ) :
// Elementor templates content goes here.
while ( have_posts() ) : the_post();
the_content();
@humayunahmed8
humayunahmed8 / slug-based-cpt-single-page.php
Created October 26, 2023 12:05
Show slug based CPT single page from external directory
<?php
function custom_section_single_template($single) {
global $post;
if ($post->post_type == 'section' && is_single()) {
$slug = $post->post_name;
if ($slug === 'catalog') {
return get_template_directory() . '/section-templates-single/single-section-catalog.php';
@humayunahmed8
humayunahmed8 / add-li-class-nav-menu.php
Last active October 24, 2023 09:14
Add LI Class for WP Nav Menu
<?php
// Add Formal/Mobile Menu li Class
function lhcorp_formal_menu_li_classes($classes, $item, $args) {
if($args->theme_location == 'formal-menu') {
$classes[] = 'glue-header__item nav-items';
}
return $classes;
}
add_filter('nav_menu_css_class', 'lhcorp_formal_menu_li_classes', 1, 3);
@humayunahmed8
humayunahmed8 / 1-button-metabox.php
Last active October 19, 2023 06:48
Conditional url type selector with codestar metabox framework
<?php
function lhcorp_section_banner_two_metabox($metaboxes){
$section_id = 0;
if ( isset( $_REQUEST['post'] ) || isset( $_REQUEST['post_ID'] ) ) {
$section_id = empty( $_REQUEST['post_ID'] ) ? $_REQUEST['post'] : $_REQUEST['post_ID'];
}
@humayunahmed8
humayunahmed8 / editable-custom-admin-colum.php
Last active October 18, 2023 04:42
Add WP custom admin column in CPT
<?php
// Add custom meta field to admin column for custom post type "story"
function add_story_custom_meta_to_admin_column($column_name, $post_id) {
if ($column_name == 'custom_meta_column') {
$stories_meta = get_post_meta($post_id, 'stories-metabox', true);
// Check if the 'title-keyword' key exists in the meta data
if (array_key_exists('title-keyword', $stories_meta)) {