Skip to content

Instantly share code, notes, and snippets.

View amElnagdy's full-sized avatar

Ahmed Mohammed Nagdy amElnagdy

View GitHub Profile
<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentysixteen-style' for the Twenty Sixteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
/*
Theme Name: Twenty Sixteen Child
Description: My Twenty Sixteen Child Theme
Author: Tahir Taous
Author URI: wpcolt.com
Template: twentysixteen
*/
<?php
// =============================================================================
// FUNCTIONS/GLOBAL/ADMIN/SIDEBARS.PHP
// -----------------------------------------------------------------------------
// Sets up functionality for unique page sidebars.
// =============================================================================
// =============================================================================
// TABLE OF CONTENTS
<h2 id="unique-string">I'm target Heading</h2>
<h2>I'm target Heading</h2>
<p id="unique-string">I'm target text</p>
@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>