Option for having the front page display a random comic (& comic blogpost for it, if applicable)
*new feature* Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
parent
d696edd7ef
commit
202e0d51ff
|
@ -79,7 +79,8 @@ function comicpress_admin() {
|
||||||
'disable_comic_frontpage',
|
'disable_comic_frontpage',
|
||||||
'disable_comic_blog_frontpage',
|
'disable_comic_blog_frontpage',
|
||||||
'disable_comic_blog_single',
|
'disable_comic_blog_single',
|
||||||
'disable_blog_frontpage'
|
'disable_blog_frontpage',
|
||||||
|
'enable_random_comic_frontpage'
|
||||||
) as $key) {
|
) as $key) {
|
||||||
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ function comicpress_load_options() {
|
||||||
'cp_theme_layout' => 'standard',
|
'cp_theme_layout' => 'standard',
|
||||||
'transcript_in_posts' => false,
|
'transcript_in_posts' => false,
|
||||||
'enable_widgetarea_use_sidebar_css' => false,
|
'enable_widgetarea_use_sidebar_css' => false,
|
||||||
|
'enable_random_comic_frontpage' => false,
|
||||||
|
|
||||||
'enable_custom_image_header' => false,
|
'enable_custom_image_header' => false,
|
||||||
'custom_image_header_width' => '980',
|
'custom_image_header_width' => '980',
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
|
|
||||||
<?php if (!$comicpress_options['disable_comic_frontpage'] && !$comicpress_options['disable_comic_blog_frontpage'] && !is_paged() ) {
|
<?php if (!$comicpress_options['disable_comic_frontpage'] && !$comicpress_options['disable_comic_blog_frontpage'] && !is_paged() ) {
|
||||||
Protect();
|
Protect();
|
||||||
|
global $frontpage_postnum;
|
||||||
|
if (isset($frontpage_postnum)) {
|
||||||
|
$post = & get_post( $frontpage_postnum );
|
||||||
|
} else {
|
||||||
$comic_query = '&showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
$comic_query = '&showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
||||||
$posts = query_posts($comic_query);
|
$posts = query_posts($comic_query);
|
||||||
|
}
|
||||||
$wp_query->is_archive = false;
|
$wp_query->is_archive = false;
|
||||||
if (have_posts()) {
|
if (have_posts()) {
|
||||||
while (have_posts()) : the_post();
|
|
||||||
comicpress_display_post();
|
comicpress_display_post();
|
||||||
endwhile;
|
|
||||||
}
|
}
|
||||||
Restore();
|
Restore();
|
||||||
UnProtect();
|
UnProtect();
|
||||||
|
|
|
@ -22,10 +22,16 @@
|
||||||
<?php
|
<?php
|
||||||
if (!$comicpress_options['disable_comic_frontpage'] && is_home()) {
|
if (!$comicpress_options['disable_comic_frontpage'] && is_home()) {
|
||||||
Protect();
|
Protect();
|
||||||
|
if ($comicpress_options['enable_random_comic_frontpage'] && is_home()) {
|
||||||
|
$comic_query = 'showposts=1&orderby=rand&cat='.get_all_comic_categories_as_cat_string();
|
||||||
|
} else {
|
||||||
$comic_query = 'showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
$comic_query = 'showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
||||||
|
}
|
||||||
$posts = query_posts($comic_query);
|
$posts = query_posts($comic_query);
|
||||||
if (have_posts()) {
|
if (have_posts()) {
|
||||||
while (have_posts()) : the_post();
|
while (have_posts()) : the_post();
|
||||||
|
global $frontpage_postnum;
|
||||||
|
$frontpage_postnum = $post->ID;
|
||||||
$wp_query->is_single = true;
|
$wp_query->is_single = true;
|
||||||
comicpress_display_comic_area();
|
comicpress_display_comic_area();
|
||||||
endwhile;
|
endwhile;
|
||||||
|
|
|
@ -64,6 +64,15 @@
|
||||||
<?php _e('Checkmark this and the blog portion of the comic will not display on the single/archive pages of your site.','comicpress'); ?>
|
<?php _e('Checkmark this and the blog portion of the comic will not display on the single/archive pages of your site.','comicpress'); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><label for="enable_random_comic_frontpage"><?php _e('Have it so that the index/front page shows a random comic each pageload?','comicpress'); ?></label></th>
|
||||||
|
<td>
|
||||||
|
<input id="enable_random_comic_frontpage" name="enable_random_comic_frontpage" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_random_comic_frontpage']); ?> />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php _e('When this is checkmarked, the front page will display a random comic from the archive.','comicpress'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue