Skip to content

Instantly share code, notes, and snippets.

View amElnagdy's full-sized avatar

Ahmed Mohammed Nagdy amElnagdy

View GitHub Profile
<?php
get_header();
if(have_posts()) : while(have_posts()) : the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile; endif;
get_footer();
?>
@amElnagdy
amElnagdy / functions.php
Last active January 7, 2017 23:43
Divi Builder on custom post types
<?php
// Divi Builder on custom post types
add_filter('et_builder_post_types', 'divicolt_post_types');
add_filter('et_fb_post_types','divicolt_post_types' ); // Enable Divi Visual Builder on the custom post types
function divicolt_post_types($post_types)
{
foreach (get_post_types() as $post_type) {
if (!in_array($post_type, $post_types) and post_type_supports($post_type, 'editor')) {
@amElnagdy
amElnagdy / gist:270b6ff4c377a2d2907a2131cdcf1fde
Last active May 1, 2016 19:53
Add Divi Meta Box to custom post type
// Add Divi Meta Box to custom post type
add_action( 'add_meta_boxes', 'divi_add_post_meta_box' );
function divi_add_post_meta_box() {
add_meta_box( 'et_settings_meta_box', esc_html__( 'Divi Post Settings', 'Divi' ), 'et_single_settings_meta_box', 'custom_post_type_slug', 'side', 'high' );
}
if ( ! function_exists( 'et_single_settings_meta_box' ) ) :
function et_single_settings_meta_box( $post ) {
$post_id = get_the_ID();
(function($) {
$(document).ready(function() {
function toggle_dps() {
setTimeout(function(){
$('.et_pb_page_layout_settings' ).closest( '#et_settings_meta_box' ).find('.et_pb_page_layout_settings').show();
},150);
}
if ($('body').hasClass('post-type-slug')) {
toggle_dps();
$('#et_pb_toggle_builder').click(function(){
@amElnagdy
amElnagdy / gist:a5fc01242372d017daaf0e29897129be
Last active May 1, 2016 19:53
Add Page Layout to CPT Meta Box
// Add Page Layout to CPT Meta Box
function divi_override_js() {
wp_enqueue_script( 'custom_script', get_stylesheet_directory_uri() .'/custom_script.js', array( 'jquery'), '1', true );
}
add_action('admin_enqueue_scripts','divi_override_js',1);
<p id="unique-string">I'm target text</p> or <h2 id="unique-string">I'm target Heading</h2>
<div id="top"></div>
__('string' , 'theme_text_domain');
and
_e('string' , 'theme_text_domain');
__(‘Hello World’, 'theme_text_domain');