Skip to content

Commit

Permalink
Added support for private bookmarks (must be logged in)
Browse files Browse the repository at this point in the history
Other various small changes
  • Loading branch information
sigel committed Feb 6, 2014
1 parent 868e382 commit 3fee81e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
14 changes: 10 additions & 4 deletions category.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@
$current_cat = get_query_var('cat');
$args=array(
'post_type' => 'bookmark',
'post_status' => array( 'publish' ),
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'menu_order',
'category__in' => $current_cat
);
query_posts($args);
if ( have_posts() ) : ?>
// Show Private Bookmarks if logged in
if ( is_user_logged_in() ) {
$args['post_status'][] = 'private';
}
query_posts($args);
if ( have_posts() ) : ?>
<h3 class="cat"><?php single_cat_title(); ?></h3>
<ul class="cat">
<?php while ( have_posts() ) : the_post(); ?>
<li<?php if ( !has_post_thumbnail() ) { echo ' class="noimg"'; } ?>><a <?php if ( get_post_meta($post->ID, 'sp_modal', true) == "on" ) { ?><?php echo 'class="modal" data-fancybox-type="iframe" ' ?><?php } ?>href="<?php if ( get_post_meta($post->ID, 'sp_url', true) ) { ?><?php echo get_post_meta($post->ID, 'sp_url', true); ?><?php } ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" <?php if ( get_post_meta($post->ID, 'sp_new', true) == "on" ) { ?><?php echo 'target="_blank"'; ?><?php } ?>><?php if ( has_post_thumbnail() ) { echo get_the_post_thumbnail($post_id, 'thumbnail'); } ?><span><?php the_title(); ?></span></a></li>
<li<?php if ( !has_post_thumbnail() ) { echo ' class="noimg"'; } ?>><a <?php if ( get_post_meta($post->ID, 'sp_modal', true) == "on" ) { ?><?php echo 'class="modal" data-fancybox-type="iframe" ' ?><?php } ?>href="<?php if ( get_post_meta($post->ID, 'sp_url', true) ) { ?><?php echo get_post_meta($post->ID, 'sp_url', true); ?><?php } ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" <?php if ( get_post_meta($post->ID, 'sp_new', true) == "on" ) { ?><?php echo 'target="_blank"'; ?><?php } ?>><?php if ( has_post_thumbnail() ) { echo get_the_post_thumbnail($post_id, 'bookmark-icon'); } ?><span><?php the_title(); ?></span></a></li>
<?php endwhile; else: ?>
<h1>Sorry, No Bookmarks Available.</h1>
<?php endif; ?>
<?php endif; ?>
</ul>
<h4><a href="/" class="icon-angle-circled-left goback"> GO BACK</a></h4>
</div><!-- .content -->
Expand Down
Binary file modified css/fancybox_sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function html5reset_setup() {
add_theme_support( 'structured-post-formats', array( 'link', 'video' ) );
register_nav_menu( 'primary', __( 'Navigation Menu', 'html5reset' ) );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150 );
add_image_size( 'bookmark-icon', 150, 150, false );
}
add_action( 'after_setup_theme', 'html5reset_setup' );

Expand Down
3 changes: 2 additions & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
</ul>
<ul class="sub-menus">
<h3>Categories</h3>
<li class="close-nav"><a title="Home" href="<?php echo get_site_url(); ?>"><span class="icon-home"></span> Home</a></li>
<?php
//for each category, show all posts
$cat_args=array(
Expand All @@ -99,7 +100,7 @@
} // if ($posts
} // foreach($categories
?>
<li class="close-nav"><a title="Quicklinks" href="#quicklinks"><span class="icon-right-dir"></span> Quicklinks</a></li>
<li class="close-nav"><a title="Quicklinks" href="#quicklinks"><span class="icon-globe"></span> Quicklinks</a></li>
<div class="pageList"><?php
$args = array(
'title_li' => '<h3>Pages</h3>',
Expand Down
7 changes: 6 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
foreach($categories as $category) {
$args=array(
'post_type' => 'bookmark',
'post_status' => array( 'publish' ),
'posts_per_page' => -1,
'category__in' => array($category->term_id),
'order' => 'ASC',
'orderby' => 'menu_order'
);
// Show Private Bookmarks if logged in
if ( is_user_logged_in() ) {
$args['post_status'][] = 'private';
}
$posts=get_posts($args);
if ($posts) {
echo '<div class="anchor"><a name="' . $category->slug . '"></a></div>';
echo '<h3 class="cat"><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></h3> ';
echo '<ul class="cat">';
foreach($posts as $post) {
setup_postdata($post); ?>
<li<?php if ( !has_post_thumbnail() ) { echo ' class="noimg"'; } ?>><a <?php if (get_post_meta($post->ID, 'sp_modal', true) == "on" ) { ?><?php echo 'class="modal" data-fancybox-type="iframe" ' ?><?php } ?>href="<?php if ( get_post_meta($post->ID, 'sp_url') ) : ?><?php echo get_post_meta($post->ID, 'sp_url', true); ?><?php endif; ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" <?php if (get_post_meta($post->ID, 'sp_new', true) == "on") { ?><?php echo 'target="_blank"'; ?><?php } ?>><?php if ( has_post_thumbnail() ) { echo get_the_post_thumbnail($post_id, 'thumbnail'); } ?><span><?php the_title(); ?></span></a></li>
<li<?php if ( !has_post_thumbnail() ) { echo ' class="noimg"'; } ?>><a <?php if (get_post_meta($post->ID, 'sp_modal', true) == "on" ) { ?><?php echo 'class="modal" data-fancybox-type="iframe" ' ?><?php } ?>href="<?php if ( get_post_meta($post->ID, 'sp_url') ) : ?><?php echo get_post_meta($post->ID, 'sp_url', true); ?><?php endif; ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" <?php if (get_post_meta($post->ID, 'sp_new', true) == "on") { ?><?php echo 'target="_blank"'; ?><?php } ?>><?php if ( has_post_thumbnail() ) { echo get_the_post_thumbnail($post_id, 'bookmark-icon'); } ?><span><?php the_title(); ?></span></a></li>
<?php
} // foreach($posts
echo '</ul>';
Expand Down
5 changes: 3 additions & 2 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@

//Fancybox
$(".modal").fancybox({
type : 'iframe',
fitToView : true,
width : '95%',
width : '90%',
maxWidth : '1600px',
height : '95%',
height : '90%',
autoSize : true,
closeClick : true,
arrows : false,
Expand Down
14 changes: 0 additions & 14 deletions single.php

This file was deleted.

2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Theme URI: http://www.startpress.org
Description: Wordpress Start Page Theme
Author: Sigel
Author URI: http://www.sigelnet.com
Version: 0.3
Version: 0.4
*/

0 comments on commit 3fee81e

Please sign in to comment.