Support

Account

Forum Replies Created

  • Wow, no idea… that’s a tricky one to troubleshoot. Last 2 suggestions that come to mind: check server error logs to see if PHP is reporting anything, and troubleshoot plugins by disabling them one at a time then testing load speed. Of course, the problem could also be due to plugins interfering with each other, so it might be worth disabling ALL the plugins and testing load speeds you turn each plugin back on.

    What a pain…

  • Perhaps something like so:

    
    <?php if( !empty( get_field('birthday') ) ): ?>
        <div class="form-question">
            <?php echo 'Birthday:'; ?>
        </div> 
        <div class="form-answer">
            <?php the_field('birthday'); ?>
        </div>
    <?php endif; ?>
    

    Or maybe you need to display the .form-question divs:

    
    <div class="form-question">
        <?php echo get_field('birthday') ? 'Birthday:' : ""; ?>
    </div> 
    <div class="form-answer">
        <?php the_field('birthday'); ?>
    </div>
    

    Just in case this looks a bit strange to you, there’s a rundown on ternary logic over here.

  • Very interesting. Did you get a chance to try out the WP Debug Bar plugin? That initial html/text load is the server running its queries and grabbing post info to display – it might be worthwhile to do a comparison of the debug bar readings between your slow site and one of the other faster sites you have on that server.

  • Yessss!! Nice work, great to see that patched up.

    The best way to proceed with updates in the future is to upgrade to ACF v4 and purchase the Repeater Field plugin – the upgrade doesn’t require any work, just update as normal and install/enable the repeater field.

    However, for now you may wish to stick with v3 until the rest of the site is stable. If that’s the case, you’ll want to avoid updating ACF, so to make sure that nobody hits that button by accident you can drop this code into the main ACF plugin file:

    add_filter('site_transient_update_plugins', 'c15465_remove_update_nag');
    function c15465_remove_update_nag($value) {
     unset($value->response[ plugin_basename(__FILE__) ]);
     return $value;
    }

    This is certainly not a good permanent solution, but it might spare you some grief in the near future.

    Oh, and here… http://www.advancedcustomfields.com/add-ons/repeater-field/. It’s a tiny one-time purchase and you can use it on as many sites as you want! Plugins like this and their devoted developers (@elliot) are well worth supporting (in my opinion).

    Good luck out there 🙂

  • Phew, that’s quite a dump… for future use, check out http://pastebin.com/, it’s a bit more dump-friendly and it will format a bit easier 🙂

    Good news – we know that the field name you are looking for is called attachments, and it’s looking for two items inside called “file” and “title”. I can emulate this setup using a repeater with 2 sub-fields inside named “File” and “Title”!

    Why don’t you try setting up two text fields inside a repeater and see what happens? I’ve attached a screenshot of what this might look like, though I’m working with v4 so it may differ a bit from your view.

  • Well, we just have to find the right field type. So long as you haven’t updated or saved the posts since the update (fingers crossed!) the field data should still be available if you switch the field back to its old type.

    There may be a hint in the template code. By looking at http://hiaconnect.edu.au/reports/, we can see that the site is reading the post-type-archive or post-type-archive-reports template. Checking out the Template Hierarchy, we can guess that the site is reading a file under the archive.php tree, possibly archive-reports.php. If you open up your theme editor (/wp-admin/theme-editor.php), see if you can find a file named something along those lines… pop that file open and see if you can locate the output for these missing fields.

    If you can’t find the field output in here, keep an eye out for <?php the_excerpt(); ?> or <?php the_content(); ?>, as the missing output may be printed inside a different file such as single.php.

    Looking at the source code of your link, the missing information appears inside a list:

    <ul class="files">
        <li>
            <a href>
            </a>
        </li>
    </ul>
    <p class="meta">...

    So look around for that <ul class="files"> and check out the PHP inside the list that prints your missing field data. Depending on the PHP output, we may be able to figure out what field type it is! Post the code you find if it doesn’t make any sense!

  • You’ll need to do a check for $row['description'] before actually echoing the <p> tag – that’s why I placed if( $row['description']) before echo '<p class="description">.... This check will simply make sure that $row['description'] is not empty.

    If this doesn’t work for you, PHP can also check for empty values in a number of different ways:

    http://php.net/manual/en/function.empty.php
    http://php.net/manual/en/function.is-null.php

    And there’s a discussion of some implementations over at http://techtalk.virendrachandak.com/php-isset-vs-empty-vs-is_null/ !

    Ah, and just for ease of reading: http://diffchecker.com/7za0xnhq 🙂

  • Check out http://wordpress.org/plugins/advanced-custom-fields/developers/ – you might want to go with 3.5.8, but if that doesn’t work try an earlier one. You will need to replace your existing /wp-content/plugins/advanced-custom-fields/ folder contents with this new plugin. Alternatively, you might be able to delete the plugin from your site’s plugins page and then upload a new version from your hard drive.

    BACK UP YOUR SITE FIRST, both database and files! Lots of things can go wrong here – you don’t want to be caught off-guard. There are lots of backup plugins out there, and your host might offer some sort of backup or restore service as well. Chances are that you will also have to restore your database to a pre-update state as well, as I am fairly sure that there are database chances between ACF v3 and v4. If you don’t have access to your pre-update database, uninstalling ACF from the Plugins page and then re-installing V3 might be your best chance.

    Since you’re working with ACF here, it would be worthwhile to export your field definitions either into PHP or XML, just for safe keeping… you might be able to use these definitions to reset your site if anything goes wrong.

  • I saw this error a few times after upgrading from ACF v3 to v4. The previous version of the plugin had the repeater field built in, and it was activated by entering a purchase key… but now (in v4) the repeater field is a separate plugin, downloaded from the store on this site. Other custom fields may behave the same way, like the Options page or the Gallery field.

    You could try to roll back to ACF v3 and see if that fixes your fields – alternatively, purchase and/or download the repeater field from the store and install on your site.

    As a disclaimer, the only reason I mention the repeater field is that your error of invalid argument supplied for foreach() indicates that your site is expecting to loop over an object or array that doesn’t exist, and the repeater field is commonly used in this kind of implementation. I’m not actually sure if you are indeed missing the repeater field, specifically.

  • Just check if the field is populated with PHP:

    
    <div class="pricelist"><?php $rows = get_field('price_list');
    if($rows)
    {
    	echo '<ul class="leaders">';
     
    	foreach($rows as $row)
    	{
    		echo '<li><span class="service">' . $row['product_or_service'] . '</span> <span class="price"> ' . $row['price'] .'</span></li>';
    		if( $row['description']) echo '<p class="description"> ' . $row['description'] .'</p>';
    	}
     
    	echo '</ul>';
    } ?>
    </div>
    
  • Not specifically – most ACF fields are designed to be accessed using code and formatted as needed.

    You might want to check out the Repeater Field – this will allow you to enter as many lines as you want, and then you’ll have to do some PHP in your template to make it display as a dropdown.

  • I don’t usually work custom fields into admin hooks very often, so I would imagine that this is only happening to get_field() calls that exist in admin-side hooks (pre_get_posts for an example). Also not really familiar with how the plugin update process works, but I do know that the plugin folder is cleaned out and the new plugin is extracted, so the errors are probably firing somewhere between those two events.

    Solution? No idea. Maybe just do your function_exists checks on the hooks and filters that apply to admin-side functions…

  • Oh, and it might be a good idea to orderby => meta_value_num if you’re using integer values like in a Unix timestamp.

  • Are you creating the custom fields from scratch and adding them to a field group, ie. outside of the post itself? If so, set up a sample custom field group and choose PHP export – you’ll get a PHP file that you can include in your script that you can tweak to add new custom fields to the field group.

    On the other hand, if you’re just adding content to a post during post creation, I think you can save the custom field content as meta data: http://codex.wordpress.org/Function_Reference/update_post_meta.

    But don’t quote me on that! There’s probably an ACF method to add data to posts on creation. 😀

  • You’re looking at doing some custom wp_query filtering! Check out the Custom Field Parameters, this will give you a rundown on how to implement.

    I don’t have quite enough time to look into pulling in GET parameters, but here’s a sample of custom field filtering that I have open in front of me. The first one does actually look at the URL for variables, but probably not the proper WP way.

    Use an action hook, make sure that you have your URL variable and the right post type, then apply your field filters:

    
    add_action('pre_get_posts', 'wpse71814_filter_search');
    function wpse71814_filter_search( $query ){
    
         if( isset($_REQUEST['search']) && ($query->query_vars['post_type'] == 'properties') ){
    
             //Collect user input from $_GET for example
            // Protect yourself!
            foreach($_REQUEST as &$get){ $get = mysql_real_escape_string($get); }
            $meta_query = $query->get('meta_query');
    
            $meta_query[] = array(
                'key'       => 'price',
                'value'     => array($_REQUEST['price_min'], $_REQUEST['price_max']),
                'type'      => 'NUMERIC',
                'compare'   => 'BETWEEN'
            );
    
            if($_REQUEST['location'] != 'any'){
                $meta_query[] = array(
                    'key'       => 'district-rel',
                    'value'     => serialize(array(0=>$_REQUEST['location'])),
                    'compare'   => 'LIKE'
                );
            }
            $query->set('meta_query',$meta_query);
    
        } // if isset
    
        return $query;
    }
    

    For this example, I’m filtering post type “properties” and doing 2 meta queries: firstly inside a price range (price_min and price_max), and secondly if a location variable has been provided I am filtering on a district_rel custom post relation field.

    Let me know if you want a hand adapting this for your date field 😉

  • Nice work.. have a great weekend!

  • I think that you’re looking at the attachment ID for the logo. Try querying the database like so:

    SELECT * from wp_posts WHERE ID = '2361';

    Is that the image you’re looking for?

  • Try this:

    <pre><?php print_r( get_field('logo_thumbnail', 'product_brand_' . $term->term_id) ); ?> </pre>

    This should let you see all of the data within your image field – paste it here if you feel like it.

    Also check your field settings where you add the field to a field group in the ACF admin. There are options for returning Image Object, Image URL, and Image ID – which one do you have selected?

  • Nice work! I use Genesis once in a while too, it’s great to know how to pull filters like this at least. I’ll have to check out that Simple Fire plugin some time…

    and you got this just in time for the weekend, that must feel great 😀

  • Yikes.

    Add the filter code to both form-user-edit.php and page.php? Lol… yeah, running out of ideas too.

  • Haha right on. Cheers!

  • So I guess it would be nice to know if the function is being executed at all – I usually do this by dropping something fairly identifiable into the first line of the function, like echo "ilovetroubleshooting";, then I watch for that to appear on the page load when the filter should have executed.

    Do you think that the add_filter() definition is ok in page.php? I wonder if it should go in functions.php instead…

  • Out of curiosity…

    
    function print_filters_for( $hook = '' ) {
        global $wp_filter;
        if( empty( $hook ) || !isset( $wp_filter[$hook] ) )
            return;
    
        print '<pre>';
        print_r( $wp_filter[$hook] );
        print '</pre>';
    }
    

    Called with:

    print_filters_for( 'acf/update_value' );

    Anything interesting in there? Is your function actually being added?

  • Nope, not yet anyway… got any JS errors on those pages?

Viewing 25 posts - 26 through 50 (of 80 total)