Last active
October 16, 2020 09:12
-
-
Save wpgaurav/d8f92da320e713bc0f3c7225588f970f to your computer and use it in GitHub Desktop.
Marketers Delight Hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Display Custom Excerpt below the headline on single posts. | |
function excerpt_single_post() { | |
if ( is_singular( 'post' ) && has_excerpt() ) { | |
the_excerpt(); | |
} | |
} | |
add_action ('md_hook_after_headline', 'excerpt_single_post'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add Search form next to logo. change 10 to other values to displace positions. | |
function add_search_form_header(){?> | |
<?php echo '<div class="csearch">'; | |
get_search_form(); | |
echo '</div>'; | |
?> | |
<?php } | |
add_action ('md_hook_header', 'add_search_form_header', 10); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove [...] from archive excerpts | |
function new_excerpt_more($more) { | |
global $post; | |
remove_filter('excerpt_more', 'new_excerpt_more'); | |
return ' '; | |
} | |
add_filter('excerpt_more','new_excerpt_more', 330); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Move main menu to the top of the page, i.e., above the logo and primary menu | |
remove_action( 'md_hook_before_content_box', 'md_main_menu', 2 ); | |
function main_menu_hook() { | |
if ( md_has_main_menu() ) | |
md_template( 'menus/main-menu' ); | |
} | |
add_action('md_hook_before_html', 'main_menu_hook'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add a custom button in primary menu | |
function trigger_hook() {?> | |
<a href="/contact/" itemprop="url" style="background:#c0392b; color:#fff; padding:8px 12px; margin-left:12px;"><span itemprop="name"><i class="md-icon-mail-alt"></i></span></a> | |
<?php } | |
add_action('md_hook_header_triggers', 'trigger_hook'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make Footer Widgets 4 Columns instead of 3. | |
function md_child_theme_footer_columns() { | |
return array( 1, 2, 3, 4 ); | |
} | |
add_filter( 'md_filter_footer_columns', 'md_child_theme_footer_columns' );?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Preload MD Icon font to boost page speed. | |
add_action('wp_head', 'add_mdicon_preload'); | |
function add_mdicon_preload(){?> | |
<link rel="preload" href="/wp-content/themes/marketers-delight/lib/assets/icons/md.woff" as="font" crossorigin="anonymous" /> | |
<?php } | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add RankMath Breadcrumbs above post title | |
function rm_bc() { | |
if (is_singular('post')){ ?> | |
<div class="byline content-inner"> | |
<?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?> | |
</div> | |
<?php } | |
} | |
add_action('md_hook_before_headline', 'rm_bc', 20); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set Marketers Delight as AMP Reader Theme. Futher optimization maybe required. | |
add_filter( 'amp_reader_themes', function ( $reader_themes ) { | |
$reader_themes[] = [ | |
'name' => 'Marketers Delight', | |
'slug' => 'marketers-delight', | |
'preview_url' => 'https://marketersdelight.com/demo', | |
'screenshot_url' => '/wp-content/themes/marketers-delight/screenshot.png', | |
'homepage' => 'https://marketersdelight.com', | |
'description' => 'Marketers Delight is a powerful content driven WP theme', | |
]; | |
$reader_themes[] = [ | |
'name' => 'Marketers Delight Child', | |
'slug' => 'md-child', | |
'preview_url' => 'https://marketersdelight.com/demo', | |
'screenshot_url' => '/wp-content/themes/marketers-delight/screenshot.png', | |
'homepage' => 'https://marketersdelight.com', | |
'description' => 'Marketers Delight is a powerful content driven WP theme', | |
]; | |
return $reader_themes; | |
} ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to improve table styling, you can use (and customize according to your needs) this code: