Jump to content

robertsmith17

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by robertsmith17

  1. Thanks for the replies, I really appreciate it.

     

    I don't really understand the syntax of 

    foreach ($customPosts as $date=>$posts){
    

     

     

    Like I said - I'm a complete novice with PHP.

     

    I'm a lot more comfortable with the likes of C#, where a foreach loop would be written something like this (for example):

    foreach (String str in stringArray){
    

     

     

    I'm afraid I just don't understand "$customPosts as $date=>$posts" at all. Could someone pseudo-code it for me? Or explain it in terms of C#/Java/JS type syntax?

     

    Thanks again. Sorry for being a bit dense...

  2. I'm a complete newbie with PHP - have been making some changes on a WordPress site and ran across an error "Warning: Invalid argument supplied for foreach() in /home/thesite/public_html/wp-content/themes/site1/custompost_entertainment.php on line 35"

     

    if ($post->post_type == 'page'){
    	echo apply_filters('the_content',$post->post_content);
    	
    	echo "<section id='featured_pages'>";
    	
    	foreach ($customPosts as $date=>$posts){
    		$date = new DateTime($date);
    		
    		foreach ($posts as $page){
    			$custom_meta = get_post_custom($page->ID);
    			
    

     

    Any ideas?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.