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 | |
// You might need to use wp_reset_query(); | |
// here if you have another query before this one | |
global $post; | |
$current_post_type = get_post_type( $post ); | |
// The query arguments | |
$args = array( |
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
/* Disable WordPress Admin Bar for all users */ | |
add_filter( 'show_admin_bar', '__return_false' ); |
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 echo excerpt(30); ?> - // Change 30 to your own number |
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 | |
function excerpt($limit) { | |
$excerpt = explode(' ', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode(" ",$excerpt).'...'; | |
} else { | |
$excerpt = implode(" ",$excerpt); | |
} |
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
<img src=" <?php the_post_thumbnail('medium'); ?>"> | |
<?php | |
// without parameter -> Post Thumbnail (as set by theme using set_post_thumbnail_size()) | |
the_post_thumbnail(); | |
the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max) | |
the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max) | |
the_post_thumbnail('medium_large'); // Medium Large resolution (default 768px x 0px max) | |
the_post_thumbnail('large'); // Large resolution (default 1024px x 1024px max) |
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 | |
if ( function_exists('add_theme_support') ) | |
add_theme_support('post-thumbnails'); |
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_filter('nav_menu_css_class', 'normalize_wp_classes', 10, 2); | |
// for the page menu fallback (wp_list_pages) | |
add_filter('page_css_class', 'normalize_wp_classes', 10, 2); | |
function normalize_wp_classes($classes, $item){ | |
// old class => new class | |
$replacements = array( |
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 | |
function abdo_widgets_init() { | |
register_sidebar( | |
array( | |
'name' => __( 'Car list', 'abdo' ), | |
'id' => 'car_list', | |
'description' => __( 'Footer Cars list', 'abdo' ), | |
'before_widget' => '', |
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 | |
function abdo($title , $post){ | |
if( $post->post_type == 'movie' ){ | |
$my_title = "Movie Title"; | |
return $my_title; | |
} | |
return $title; |