Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$20
Magic Fields plugin | Call featured Latest Events on sidebar
http://cl.ly/3c1F0t001U2M0J0l0623
The content is managed using Magic Fields 1.5.7 and the back-end looks like this:
http://cl.ly/1h2U0c3S3p3A1v2X0E3J
When you check the boxes it should work, but after a WordPress upgrade or after reaching a number of posts no content is showing up, however in Firebug it seems the loop is working:
HTML Output:
http://pastebin.com/swD6pmZs
screenshot:
http://cl.ly/3Z1R2x313D2e2t393K2L
Here is the full code in sidebar.php.
http://pastebin.com/q0JfVKf5
Let me know if you think there is an issue with the code logic or a plugin bug and if you can help.
This question has been answered.
Lucian Florian | 01/13/12 at 3:23pm
Edit
Previous versions of this question:
01/13/12 at 3:24pm
| 01/13/12 at 3:25pm
| 01/13/12 at 3:25pm
| 01/13/12 at 3:25pm
| 01/13/12 at 3:45pm
| 01/13/12 at 3:45pm
(5) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
01/13/12
3:32pmSébastien | French WordpressDesigner says:have you change anything before finding this bug ?
add a plugin ? upgrade magic field ? upgarde wordpress etc...- 01/13/12 3:36pm
Lucian Florian says:We discovered this recently and I don't know when that happened. It happened after it reached a certain amount of posts I believe.
- 01/13/12 3:39pm
Sébastien | French WordpressDesigner says:what is the HTML outputed by your code ?
- 01/13/12 3:39pm
Sébastien | French WordpressDesigner says:OR could you give me the url of this page ?
- 01/13/12 3:46pm
Lucian Florian says:Here it is: http://pastebin.com/swD6pmZs
- 01/13/12 3:49pm
Sébastien | French WordpressDesigner says:replace your code by this code and tell me what is the output please
<?php
/**
* The Sidebar containing the primary and secondary widget areas.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
function filtered($name){
$name = strtolower($name);
switch($name){
case "press":
return "IPSO Press release";
default:
return $name;
}
}
global $is_homepage;
$upcoming_event = array();
$upcoming_events = array();//create the array for the homepage events
?>
<div id="primary" class="widget-area" role="complementary">
<?php
/* When we call the dynamic_sidebar() function, it'll spit out
* the widgets for that widget area. If it instead returns false,
* then the sidebar simply doesn't exist, so we'll hard-code in
* some default sidebar stuff just in case.
*/
if ( $is_homepage) : ?>
<h1 class="new">What's New</h1>
<div id="slider1">
<ul id="announcements" class="widget-container">
<?php query_posts($query_string . '&cat=*'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<? // if (get('new_item') && (get('new_removal_date')>=date("m/d/Y") || !get('new_removal_date'))) { ?>
<li id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="new-category"><?php echo filtered(get_panel_name()); ?></h1>
<h2 class="new-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php if ( get("new_custom_content")) : // Only display excerpts for archives and search. ?>
<div class="entry-summary">
<?php echo get("new_custom_content"); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_excerpt(); ?>
</div><!-- .entry-content -->
<?php endif; ?>
</li><!-- #post-## -->
<? // } ?>
<? //PUT THE UPCOMING EVENTS INTO AN ARRAY FOR LATER
$event = get_group('Home: Upcoming Events Area');
if(count($event)) {
$e_info = array(get_the_ID(),
the_title('','',false),
get_the_excerpt(),
get('upcoming_item'),
get('upcoming_removal_date'),
get('upcoming_custom_content'));
array_push($upcoming_events,$e_info);
} ?>
</li><!-- #post-## -->
<?php endwhile; ?>
<?php endif; ?>
</ul>
</div><!-- end slider1 -->
<?php else : ?>
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul class="submenu">
<?php echo $children; ?>
</ul>
<?php } ?>
<?php endif;// end primary widget area ?>
</div><!-- #primary .widget-area -->
<div id="primary_footer"></div>
<?php if ( $is_homepage) : ?>
<div id="secondary" class="widget-area" role="complementary">
<ul>
<h1 class="upcoming">Upcoming Events</h1>
<?php
foreach($upcoming_events as $upcoming_event) {
if($upcoming_event[4]>=date("m/d/Y") || !$upcoming_event[4] && $upcoming_event[3]){
echo '<li><p class="title"><a href="?p='.$upcoming_event[0].'">'.$upcoming_event[1].'</a></p>';
if($upcoming_event[5]){
echo $upcoming_event[5];
}
echo '</li>';
}
}
?>
<!-- <li><p class="title">Embedded Systems Conference, Boston Sept. 20-23rd 2010</p> -->
<!-- <p> – Include a pop up box with the following info – IPSO’s Chairman Geoff Mulligan to speak Tuesday evening from 6pm -6:40 pm at the ESC theater on the benefits of IP sensors for connecting the Smart Grid</p> --><!-- </li> -->
</ul>
</div>
<div id="secondary_footer"></div>
<p class="button">
<script language="JavaScript" type="text/javascript">
// Copyright © 2005 Voormedia - WWW.VOORMEDIA.COM
var i,y,x="3c6120687265663d226d61696c746f3a696e666f406970736f2d616c6c69616e63652e6f72673f7375626a6563743d47656e6572616c253230496e666f726d6174696f6e223e4950534f20496e666f726d6174696f6e3c2f613e";y='';for(i=0;i<x.length;i+=2){y+=unescape('%'+x.substr(i,2));}document.write(y);
</script>
</p>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://www.facebook.com/pages/IPSO-Alliance/281025795247310" send="true" width="280" show_faces="false" font=""></fb:like>
<div class="socials">
<h3 class="feature-category">FOLLOW IPSO</h3>
<ul class="clearfix">
<li><a href="http://www.facebook.com/IPSOAlliance" target="_blank"><img src="<?php bloginfo( 'template_directory' ); ?>/images/socials/fb-new2.png" alt="fb-new2" width="" height="" /></a></li>
<li><a href="<?php bloginfo( 'url' ); ?>/feed" target="_blank"><img src="<?php bloginfo( 'template_directory' ); ?>/images/socials/rss-new.png" alt="rss-new" width="" height="" /></a></li>
<li><a href="http://twitter.com/IPSOAlliance" target="_blank"><img src="<?php bloginfo( 'template_directory' ); ?>/images/socials/twitter-new2.png" alt="twitter-new2" width="" height="" /></a></li>
<li><a href="http://www.linkedin.com/company/ipso-alliance" target="_blank"><img src="<?php bloginfo( 'template_directory' ); ?>/images/socials/linkedin-new.png" alt="linkedin-new" width="" height="" /></a></li>
</ul>
</div>
<?php endif;// end secondary widget area ?> - 01/13/12 3:57pm
Lucian Florian says:It now shows all the posts for What's New area
http://pastebin.com/eqNWx5q9
http://cl.ly/140q2L163Q3b1b3V2h1I - 01/13/12 4:47pm
Sébastien | French WordpressDesigner says:this is strange :
get('new_removal_date')>=date("m/d/Y")
i think you must explode and concanate dates to compare two dates.
something like that
$date = date("m/d/Y");
$date = explode("/", $date);
$date = $date[2].$date[0].$date[1];
get('new_removal_date') must have the same form $year.$mont.$day
and you can compare the dates - 01/13/12 4:47pm
Sébastien | French WordpressDesigner says:"concatanate"
not "concanate" - 01/13/12 4:52pm
Sébastien | French WordpressDesigner says:Now, what's the form of 'new_removal_date' ?
is it : year month day ?
- 01/13/12 3:36pm
-

Last edited:
01/13/12
3:56pmLuis Abarca says:You should use global $query_string before use it too.
function filtered($name){
global $query_string;
$name = strtolower($name);
switch($name){
case "press":
return "IPSO Press release";
default:
return $name;
}
}
global $is_homepage;
//...
- 01/13/12 3:56pm
Luis Abarca says:You should use global $query_string before use it too.
function filtered($name){
global $query_string;
$name = strtolower($name);
switch($name){
case "press":
return "IPSO Press release";
default:
return $name;
}
}
global $is_homepage;
//...
- 01/13/12 3:58pm
Lucian Florian says:I added that. Still no change
- 01/13/12 4:08pm
Luis Abarca says:I dont understand the use of * in this line, i think you can delete that &cat=*
<?php query_posts($query_string . '&cat=*'); ?>
Can you var dump the $post var in the loop and paste it the results ? - 01/13/12 4:20pm
Lucian Florian says:I deleted that. Still does nothing. I agree code is advanced. Not sure if there is another way to write it.
- 01/13/12 3:56pm
-

Last edited:
01/13/12
9:20pmChristianto says:Hi,
this part of comparison could be failed
if(get('new_item') && (get('new_removal_date') >= date("m/d/Y") || !get('new_removal_date')))
you should use strtotime to compare it, I think date() is returning as string and could not be compare greater or less than.
$removal_date = strtotime(get('new_removal_date'));
$current_time = strtotime(date("m/d/Y"));
if(get('new_item') && ($removal_date >= $current_time || !get('new_removal_date'))){
// your loop content here
}
Hope this help..
edit: fix typosPrevious versions of this answer: 01/13/12 at 9:19pm | 01/13/12 at 9:20pm
- 01/14/12 9:27am
Lucian Florian says:still does nothing
- 01/14/12 9:27am
-

Last edited:
01/13/12
11:55pmKannan C says:Did you checked the input names of the 'upcoming' fields are same as old one? because the new version of magic fields plugin has a change in the input name structure forming than the previous. I previously faced the same problem after upgrading the plugin for one of my client.
- 01/14/12 9:27am
Lucian Florian says:As I mentioned is not the new version of Magic fields. It's the older one.
- 01/14/12 9:27am
-

Last edited:
01/14/12
12:26amHai Bui says:I should post the the answer here but I think for this kind of problem (pretty hard to debug without seeing the data and doing testing), it's best you give WP admin access to one of the experts. You can PM me if you want. I'm sure we can fix it very quickly, it's better than guessing and trying everything here.
- 01/14/12 9:28am
Lucian Florian says:Since this would require more debugging indeed, I will give Hai Bui temporary access to the site.
- 01/14/12 12:10pm
Lucian Florian says:Hai Bui helped me solve the issues and did a great job!
- 01/14/12 9:28am
This question has expired.
Lucian Florian, John Cotton, Francisco Javier Carazo Gil voted on this question.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
