Permalink
Browse files

Added Al-Sharq

  • Loading branch information...
0 parents commit 0877469d42aa3948a4b6c095973a35a7ea7f9901 Menelik S. Young @ MSY-MBP committed Feb 23, 2012
@@ -0,0 +1,19 @@
+About Project
+=============
+
+Three .PHP files containing sample code that I have written for an online newspaper here in Saudi Arabia, called Al-Sharq. Due to the tight deadline and budget, the client specifically requested a customized WordPress theme, and wanted it to be as easy as possible to be updated. Therefore we decided to use Canvas as the base for the theme, which we heavily customized.
+
+Note
+-----
+
+To distinguish the code that I have written, from Canvas's code, I have left the following comments to indicate where my code begins and ends:
+
+* '//My Code Begins Here:' or '<!--My Code Begins Here: --> denotes where my code starts
+* '//My Code Ends Here:' or '<!--My Code Ends Here--> denotes where my code ends
+* the fully functional website can be seen here: http://www.alsharq.net.sa/
+* You will notice some Arabic text in the source code.
+
+Why I'm proud of this project
+-----------------------------
+
+This project gave me a chance to use WordPress custom taxonomies, post types and loops in fun and creative ways. It also allowed me to develop for Arabic content; a welcomed opportunity to use my second language. Being fluent in Arabic has always been an advantage.
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Post Content Template
+ *
+ * This template is the default page content template. It is used to display the content of the
+ * `single.php` template file, contextually, as well as in archive lists or search results.
+ *
+ * @package WooFramework
+ * @subpackage Template
+ */
+
+/**
+ * Settings for this template file.
+ *
+ * This is where the specify the HTML tags for the title.
+ * These options can be filtered via a child theme.
+ *
+ * @link http://codex.wordpress.org/Plugin_API#Filters
+ */
+ global $woo_options;
+
+ $title_before = '<h1 class="title">';
+ $title_after = '</h1>';
+
+ //My Code Begins:
+ $editor_term = wp_get_object_terms( $post->ID, 'editor_names');
+ $editor_name = $editor_term[0]->name;
+ //My Code Ends
+
+ if ( ! is_single() ) {
+
+ $title_before = '<h2 class="title">';
+ $title_after = '</h2>';
+
+ $title_before = $title_before . '<a href="' . get_permalink( get_the_ID() ) . '" rel="bookmark" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">';
+ $title_after = '</a>' . $title_after;
+
+ }
+
+ $page_link_args = apply_filters( 'woothemes_pagelinks_args', array( 'before' => '<div class="page-link">' . __( 'Pages:', 'woothemes' ), 'after' => '</div>' ) );
+
+ woo_post_before();
+?>
+<div <?php post_class(); ?>>
+<?php
+ woo_post_inside_before();
+
+ //My Code Begins:
+
+ //Check if Editorial has been assigned an editor. Only posts with Editors will be displayed.
+ if ($editor_term[0]) :
+ echo $title_before . $editor_name . $title_after;
+ else :
+ the_title( $title_before, $title_after );
+ endif ;
+ if ( !is_singular() ) { ?>
+
+ <?php woo_image( 'width='.$woo_options['woo_thumb_w'].'&height='.$woo_options['woo_thumb_h'].'&class=thumbnail '.$woo_options['woo_thumb_align'] ); ?>
+ <div class="post-more">
+ <?php echo do_shortcode('[post_categories]'); ?>
+ </div>
+<?php } ?>
+ <?php if ( is_single() ) { ?>
+ <?php woo_post_meta(); ?>
+ <?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
+
+ <!-- My Code Ends: -->
+
+ <div class="post-more">
+ <ul class="social_share">
+ <li>شارك:</li>
+ <li><?php echo do_shortcode('[twitter style="horizontal" related="albiladdaily" source="albiladdaily" float="none"]'); ?></li>
+ <li><?php echo do_shortcode('[fbshare type="button_count" float="none"]'); ?></li>
+ <li><?php echo do_shortcode('[google_plusone size="medium" count="true" float="none"]'); ?></li>
+ </ul>
+ <div class="clear"></div>
+ </div>
+
+ <?php }?>
+
+ <div class="entry">
+ <?php
+ if ( $woo_options['woo_post_content'] == 'content' || is_single() ) {
+ the_content(__('Continue Reading &rarr;', 'woothemes') );
+
+ //My Code Begins:
+
+ //Check if Editorial has been assigned an editor. Only posts with Editors will be displayed.
+ if ($editor_term[0]) :
+
+ echo '<h2>
+ مقالات الكاتب
+ ' . $editor_name . '</h2>';
+
+ //Query to retrieve the Editorials assigned to the editor's name
+ $editorial_query = new WP_Query( array( 'editor_names' => $editor_term[0]->slug, 'post_type' => 'editorials') );
+
+ //editorial loop
+ while ( $editorial_query->have_posts() ) : $editorial_query->the_post();
+
+ //Display the title
+ echo '
+
+ <h3><a href="'. get_permalink() . '">' . get_the_title() . '</a></h3>
+
+ ';
+
+ //end the Editor's Profile loop
+ endwhile;
+ // Reset Post Data
+ wp_reset_postdata();
+ endif;
+
+ //My Code Ends
+
+ }
+ if ( $woo_options['woo_post_content'] == 'content' || is_singular() ) wp_link_pages( $page_link_args );
+ ?>
+
+ </div><!-- /.entry -->
+ <div class="fix"></div>
+<?php
+ woo_post_inside_after();
+
+?>
+</div><!-- /.post -->
+<?php
+ woo_post_after();
+
+ $comm = $woo_options[ 'woo_comments' ];
+ if ( ( $comm == 'post' || $comm == 'both' ) && is_single() ) { comments_template(); }
+?>
@@ -0,0 +1,166 @@
+<?php
+/**
+ * Editorial Content Template
+ *
+ * This template is the default page content template. It is used to display the content of the
+ * `single-editorials.php` template file, as well as in archive lists or search results.
+ *
+ * @package WooFramework
+ * @subpackage Template
+ */
+
+/**
+ * Settings for this template file.
+ *
+ * This is where the specify the HTML tags for the title.
+ * These options can be filtered via a child theme.
+ *
+ * @link http://codex.wordpress.org/Plugin_API#Filters
+ */
+ global $woo_options;
+
+ $title_before = '<h1 class="title">';
+ $title_after = '</h1>';
+
+ //My Code Begins:
+
+//Editor's name retrieved from its assigned editorial
+$editorial_author_term = wp_get_object_terms( $post->ID, 'editor_names');
+$editorial_author_name = $editorial_author_term[0]->name;
+
+//Check if Editorial has been assigned an editor. Only posts with Editors will be displayed.
+if ($editorial_author_term[0]) :
+
+ //Query to retrieve the Editor's Profile info that is associated with the Editor's name
+ $editorial_author_query = new WP_Query( array( 'editor_names' => $editorial_author_term[0]->slug, 'post_type' => 'editor_profiles', 'posts_per_page' =>1 ) );
+ //The Editor's Profile loop
+ while ( $editorial_author_query->have_posts() ) : $editorial_author_query->the_post();
+
+ //collect the thumbnail
+ $editor_thumbnail_id = get_post_thumbnail_id();
+ $editor_thumbnail_link = wp_get_attachment_url($editor_thumbnail_id);
+ $editor_photo_link = '<a href="'. get_permalink() . '"><img src="'. $editor_thumbnail_link . '"></a>';
+ //collect the name
+ $editor_name = '<a href="'. get_permalink() . '">' . $editorial_author_name . '</a>';
+
+ //end the Editor's Profile loop
+ endwhile;
+ // Reset Post Data
+ wp_reset_postdata();
+ endif;
+
+ //My Code Ends
+
+ if ( !is_single() ) :
+
+ $title_before = '<h2 class="title">';
+ $title_after = '</h2>';
+
+ $title_before = $title_before . '<a href="' . get_permalink( get_the_ID() ) . '" rel="bookmark" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">';
+ $title_after = '</a>' . $title_after;
+
+ endif;
+
+ $page_link_args = apply_filters( 'woothemes_pagelinks_args', array( 'before' => '<div class="page-link">' . __( 'Pages:', 'woothemes' ), 'after' => '</div>' ) );
+
+ woo_post_before();
+?>
+
+<div <?php post_class(); ?>>
+
+ <?php
+ woo_post_inside_before();
+ if ( !is_singular() ) :
+
+ //My Code Begins:
+
+ if ($editor_photo_link) :
+
+ echo $editor_photo_link;
+
+ endif;
+
+ ?>
+ <div class="clear"></div>
+ <div class="editorial_main">
+ <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
+ <span class="editorial_author_name"><?php echo $editor_name; ?></span>
+
+<!--My Code Ends -->
+
+ <div class="post-more">
+ <?php echo do_shortcode('[post_tags]'); ?>
+ <?php echo do_shortcode('[post_comments]'); ?>
+ <div class="clr"></div>
+ </div>
+ </div>
+
+
+ <?php
+ //end !is_singular()
+ endif;
+ ?>
+
+ <?php
+
+ //My Code Begins:
+
+ if ( is_single() ) :
+
+ if ($editor_photo_link) :
+
+ echo $editor_photo_link;
+
+ endif;
+?>
+
+ <div class="clear"></div>
+
+ <div class="editorial_main">
+ <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
+ <span class="editorial_author_name"><?php echo $editor_name; ?></span>
+ </div>
+
+<!-- My Code Ends -->
+
+ <div class="post-more">
+ <ul class="social_share">
+ <li>شارك:</li>
+ <li><?php echo do_shortcode('[twitter style="horizontal" related="albiladdaily" source="albiladdaily" float="none"]'); ?></li>
+ <li><?php echo do_shortcode('[fbshare type="button_count" float="none"]'); ?></li>
+ <li><?php echo do_shortcode('[google_plusone size="medium" count="true" float="none"]'); ?></li>
+ <li class="post-reply"><a href="#respond">أضف تعليق</a></li>
+ </ul>
+
+ <?php echo do_shortcode('[post_comments]'); ?>
+
+ <div class="clear"></div>
+
+ </div>
+
+ <?php echo albilad_reaction_buttons_html();?>
+
+ <?php
+ //end if is_single()
+ endif;
+ ?>
+
+ <div class="entry">
+ <?php
+ if ( $woo_options['woo_post_content'] == 'content' || is_single() ) { the_content(__('Continue Reading &rarr;', 'woothemes') ); }
+ if ( $woo_options['woo_post_content'] == 'content' || is_singular() ) wp_link_pages( $page_link_args );
+ ?>
+
+ </div><!-- /.entry -->
+
+ <div class="fix"></div>
+
+</div><!-- /.post -->
+
+<?php
+ woo_post_after();
+ $comm = $woo_options[ 'woo_comments' ];
+ if ( ( $comm == 'post' || $comm == 'both' ) && is_single() ) :
+ comments_template();
+ endif;
+?>
Oops, something went wrong.

0 comments on commit 0877469

Please sign in to comment.