Hello Joern,
I need your help.. I just found out this code on arthemia premium and it works well on arthemia free..
I just want to customize it a little more.. I tried to edit the code all by myself but I failed.. Hope you can help me.. I just want to show the random post in a 3 by 3 arrangement of pictures because this is only for 6 by 2..
Heres the code:
Code:
<div id="random">
<h3><?php _e('Random Posts','arthemia');?></h3>
<?php $width = get_settings ( "cp_thumbWidth_Gallery" );
$height = get_settings ( "cp_thumbHeight_Gallery" );
if ( $width == 0 ) { $width = 80; }
if ( $height == 0 ) { $height = 80; }
$status = get_settings ( "cp_thumbAuto" );
?>
<?php $randompost = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY RAND() LIMIT 12");
foreach ($randompost as $post) {
$ID = $post->ID;
$postid = get_post($post->ID);
$title = $postid->post_title;
$values = $wpdb->get_var("SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $ID AND meta_key = 'Image' ");
?>
<?php if ( $status != "first" ) { ?>
<?php
if (isset($values)) {
?>
" rel="bookmark" title="<?php echo $title; ?>"><img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
echo $values; ?>&w=<?php echo $width; ?>&h=<?php echo $height; ?>&zc=1&q=100"
alt="<?php echo $title; ?>" class="left" width="<?php echo $width; ?>px" height="<?php echo $height; ?>px" />
<?php } ?>
<?php } else { ?>
<?php $id =$post->ID;
$the_content =$wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id");
$home = get_option('home');
$pattern = '!<img.*?src="'.$home.'(.*?)"!';
preg_match_all($pattern, $the_content, $matches);
$image_src = $matches['1'][0]; ?>
<?php if($image_src != '') { ?>" rel="bookmark" title="<?php echo $title; ?>">
<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $image_src; ?>&w=<?php echo $width; ?>&h=<?php echo $height; ?>&zc=1&q=100"
alt="<?php echo $title; ?>" class="left" width="<?php echo $width; ?>px" height="<?php echo $height; ?>px" /><?php } ?>
<?php } ?>
<?php } ?>
<div class="more" style="margin-top:-10px;padding-right:15px;font-weight:bold;float:right;"><?php _e('(refresh random posts)','arthemia');?></div>
</div>
Thank you.. hope you can help me.. Im starting to learn php.
(von: saber210)
Hier noch 9 weitere Ergebnisse dieses Threads:
Re: Random Post :: Reply by Joern
5. Mai. 2011 (von: Joern)
can't see it on your site in the moment.First I would try to set in this line:Code:$randompost = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY RAND() LIMIT 12");the LIMIT to 18Code:$randompost = $wpdb->get_results("SELECT…
Re: Random Post :: Reply by Joern
5. Mai. 2011 (von: Joern)
Oh, I think you have the random posts in the featured section?One hint, uncomment in style.css near line 390 the position: absolute; and left: 780px;like this:#featured { float: right; font-size: 12px;/* left: 780px; */ padding: 5px 5px 0 1... Weiterlesen…
Re: Random Post :: Reply by saber210
6. Mai. 2011 (von: saber210)
Thanks Joern, I got it working now..I just want to ask about absolute position.. Will this work on any screen resolution? I dont want it to overlap when view on other screen resolutions..And one other thing, the limit on sql…
Re: Random Post :: Reply by Joern
6. Mai. 2011 (von: Joern)
about the position: the div is anyway positioned inside the div around, here div id="top"this has nothing to do with screen resolution as top is 930px wide in all cases and featured takes 320px aligned to the right (float:right) in…
Re: Random Post :: Reply by saber210
7. Mai. 2011 (von: saber210)
Thanks Joern,But the code seems dont work.. I tried it once and no random post showed up..Another thing, I want to remove the thumbnail on single post and replace it with whole picture? is that possible? Weiterlesen →
Re: Random Post :: Reply by Joern
7. Mai. 2011 (von: Joern)
In your Arthemia Premium Dashboard you should have a page for theme options.Find 'Single Post Page Settings' and set here the thumbnail size to a bigger value like 550px wide and 550px highAnother way is to select the option not…
Re: Random Post :: Reply by saber210
7. Mai. 2011 (von: saber210)
Thanks admin.. how about doubling the category bar? In arthemia free it is very easy but in arthemia premium i think it is hard..Code:<?php $showcatbar1 = get_settings ( "cp_showpostcatbar" ); $showcatbar2 = get_settings ( "cp_showarchivecatbar"…
Re: Random Post :: Reply by Joern
7. Mai. 2011 (von: Joern)
right, this part in header.php generates the category bar in index, archive or post, whatever you select.Important here is $postcat = get_settings( "ar_categories" )means the theme get's the categories from the options settings in your dashboard.The admin menu you see…
Re: Random Post :: Reply by saber210
8. Mai. 2011 (von: saber210)
Thanks admin.. but it doesnt work..EDIT: i found a solution on this line Code:$postcat = array_slice($postcat, 0, 5);sort($postcat);I just change 5 to 10 and it works..Thanks again admin! Weiterlesen →