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 | |
$the_query = new WP_Query( 'showposts=2' ); | |
while ($the_query -> have_posts()) : $the_query -> the_post(); | |
$thumb_id = get_post_thumbnail_id(); | |
$thumb_url = wp_get_attachment_image_src($thumb_id, true); | |
?> | |
<li> | |
<a href="<?php the_permalink() ?>"> | |
<img src="<?php echo $thumb_url[0]; ?>" /> |
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 next_post_link() ?> - Displays Newer Posts link | |
<?php previous_post_link() ?> - Displays previous link |
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 | |
global $post; | |
$categories = get_the_category(); | |
foreach ($categories as $category) : | |
?> | |
<h3>More News From This Category</h3> | |
<ul> | |
<?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 if(have_posts()) : while(have_posts()) : the_post(); ?> | |
<?php | |
// الكود الخاص بالتدوينة | |
?> | |
<?php endwhile; ?> | |
<?php else : ?> | |
<p>المعذرة, ما تبحث عنه غير متوفر هنا</p> |
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
You must first register the strings for translation. | |
For example you echo "Hello world" in some template file like this: | |
<?php pll_e('Hello world'); ?> | |
To show string in the "Strings translation" add in your functions.php: | |
<?php | |
add_action('init', function() { | |
pll_register_string('mytheme-hello', 'Hello world'); |
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(pll_current_language() == 'ar') { ?> | |
<?php } else if(pll_current_language() == 'en') { ?> | |
<?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_filter( 'get_the_archive_title', 'my_theme_archive_title' ); | |
/** | |
* Remove archive labels. | |
* | |
* @param string $title Current archive title to be displayed. | |
* @return string Modified archive title to be displayed. | |
*/ | |
function my_theme_archive_title( $title ) { |
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
// A nice, way to display linked categories is by using a comma as separator | |
<?php the_category( ', ' ); ?> | |
// The separator will not be added after the last linked category. By using the following reasoning, each of the linked categories can also be enclosed, for example, in a <div> element: | |
<?php the_category( '</div><div>' ); ?> | |
// or to use the linked categories in a sentence: | |
This post has <?php the_category( ', ' ); ?> as categories. | |
// The simplest way to display a category, or a list of categories, without links is by using the following code: |
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 | |
$post = $wp_query->post; | |
if ( in_category('2') ) { | |
include(TEMPLATEPATH . '/single-play.php'); } | |
elseif ( in_category('3') ) { | |
include(TEMPLATEPATH . '/single-read.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 wp_redirect( home_url() ); exit; ?> |
NewerOlder