Skip to content

Instantly share code, notes, and snippets.

View amElnagdy's full-sized avatar

Ahmed Mohammed Nagdy amElnagdy

View GitHub Profile
@amElnagdy
amElnagdy / 2017-custom-front-page-sections
Created November 26, 2016 02:57
A simple function to control the number of Twenty Seventeen Theme Front Page Sections by WPColt.com
/*
* A simple function to control the number of Twenty Seventeen Theme Front Page Sections
* Source: wpcolt.com
*/
function wpc_custom_front_sections( $num_sections )
{
return 5; //Change this number to change the number of the sections.
}
add_filter( 'twentyseventeen_front_page_sections', 'wpc_custom_front_sections' );
@amElnagdy
amElnagdy / enable-divi-settings.php
Created November 24, 2016 13:19
A simple code to enable Divi settings metabox on custom post types
add_action('add_meta_boxes', 'divicolt_add_meta_box');
function divicolt_add_meta_box()
{
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'editor') and function_exists('et_single_settings_meta_box')) {
$obj= get_post_type_object( $post_type );
add_meta_box('et_settings_meta_box', sprintf(__('Divi %s Settings', 'Divi'), $obj->labels->singular_name), 'et_single_settings_meta_box', $post_type, 'side', 'high');
}
}
}
@amElnagdy
amElnagdy / gist:65d2e487154824373a1b82aea2ea45ce
Created July 27, 2016 20:00
Disable Plugin and Theme Editor
//Add to wp-config.php file
define('DISALLOW_FILE_EDIT', true);
@amElnagdy
amElnagdy / secure-wp-config.php
Last active July 27, 2016 19:39
Secure your wp-config.php
// Add to your .htaccess file
<Files wp-config.php>
order allow,deny
deny from all
</Files>
@amElnagdy
amElnagdy / gist:6e8a5902ae3ecc36ab36ae04ffde4876
Created July 18, 2016 17:06
A simple fix for jQuery is not defined in WordPress
//source: https://wpcolt.com/jquery-not-defined-possible-causes-fix-wordpress/
define('CONCATENATE_SCRIPTS', false);
<span class="updated"> '.$updated_time.'</span>
$updated_time = get_the_modified_time('F jS, Y');
<span class="date updated published"><?php the_time(); ?></span>
<span class="date updated published"><?php the_time( get_option('date_format') ); ?></span>
<h1 class="entry-title">The title</h1>