Forum Replies Created

Viewing 15 replies - 241 through 255 (of 409 total)
  • Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    The theme is likely not saving a value for the ‘checkbox’ setting unless it’s checked. If a checkbox isn’t checked, it isn’t included in the submitted form. If the plugin uses the submitted form directly (without checking for the presence of the ‘checkbox’ field and appropriately setting its value to 0 if it isn’t present), then that setting won’t get saved in the settings array. Thus your use of $options['checkbox'] is referencing an array element that does not exist.

    You can account for that by modifying you code snippet as such:

    function sunburst_theme_checkbox_input() {
    	$options = get_option( 'sunburst_theme_options' );
    	if ( ! isset( $options['checkbox'] ) )
    		$options['checkbox'] = 0;
    	?> <input id='checkbox' name='sunburst_theme_options[checkbox]' type='checkbox' value='1' <?php checked( $options['checkbox'], 1  ) ; ?> />
    <?php }
    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    @aassddff: Your original example code is the most straightforward for getting random posts. Depending on the number of posts your blog has, you’ll likely not notice the difference between that approach and a more efficient approach.

    If you want a more efficient approach, however, here’s an variation based on what you had above:

    <ul>
    <?php
    global $wpdb;
    $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post';" );
    shuffle( $post_ids );
    $rand_posts = get_posts( array( 'include' => array_slice( $post_ids, 0, 10 ) ) );
    foreach ( $rand_posts as $p ) : ?>
       <li><a href="<?php echo get_permalink( $p->ID ); ?>"><?php echo get_the_title( $p->ID ); ?></a></li>
    <?php endforeach; ?>
    </ul>

    This approach obtains all valid post IDs from the database, randomizes them in PHP, and selects 10 for use to query for actual posts.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Belated follow-up to this, but this ability was added to v3.5 of the plugin.

    Each section that can have its own custom post limit now also has the ability to separately define the front page limit for that section. So your front page can show 3 posts, whereas pages 2+ could be set to show 10 each.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Belated follow-up on this, but the problem should not be present in more recent versions of the plugin (the current latest being v3.6). Let me know if you experience otherwise.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Unfortunately the widget does not currently facilitate being as freeform with the output of multiple custom fields for a post as is possible when using the template tags within template files (as that’s what you seem to be saying you currently do).

    If you’re already using the template tags within a post/page template, you can also use them in the sidebar. There are variations of get_custom(), such as get_current_custom() that work in the sidebar template.

    But I do understand your use case though. I have plans for additional functionality that will make doing what you want to do quite easy. No time estimate on when it’ll be ready though. Until then it’s either the template tag approach, or multiple widgets.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Yes, the widget only retrieves a custom field according to a specific field/key. That field can appear multiple times for a post, or in multiple posts. It currently does not support retrieving multiple custom field keys in a single widget or request.

    Could you provide an example use case where you want to get the values for multiple custom field keys in a single widget?

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Could you provide an excerpt of some lines from your text replacement rules so that I can test out the replacements you are attempting?

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Please try v3.2.2 of the plugin and report back whether it’s working any better for you or not. If it doesn’t, please provide an example or two of text replacement rules you have defined so that I can test them out.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Great suggestion! You can definitely expect to have this in v3.4 of the plugin, which should be out soon. Thanks!

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Are you sure you’re posting this issue under the correct plugin? The Category Image(s) plugin does not facilitate you adding an image. It assumes you’re already able to get the images onto your server into the appropriate locations. (Basically, it has no interface and is code-only.)

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Glad the plugin has been of use to you!

    As you’ve figured out, quotes that you want to send as part of the value of a shortcode attribute (field, before, after, between) need to be encoded. Otherwise, the shortcode parser for WP has problems making sense of the shortcode.

    It’s a good point though, so I’m going to add an explanation to the FAQ to help others in the future.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Do you have the checkbox labeled “Case sensitive text replacement?” checked? It is checked by default.

    If so, then a replacement rule of:

    foo => bar

    would not replace “Foo” in the text because of the capital “F”. Try with the checkbox unchecked, or by defining a case specific rule, e.g.

    Foo => bar

    or try “foo” in your post.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    The function c2c_get_current_custom() relies on WordPress’s get_post_custom_values() function. The latter performs a query without specifying an ORDER BY clause in the SQL, so the order of the data returned cannot be depended on (as you’ve noticed).

    Presumably you’d expect/prefer the custom field values to be ordered alphabetically?

    In thinking about it, it seems like it may be worthwhile for me to allow specifying an ‘order’ argument to a few of the functions. In the meantime, there isn’t a straightforward solution for you. Depending on where and how you’re using the function, you can invoke the output formatting function directly with the sorted custom field values.

    For example, Instead of something like this:

    echo c2c_get_current_custom( 'myfield', '', '', '', ', ' );

    You’d do:

    $cfvalues =  (array) get_post_custom_values( 'myfield', get_the_ID() );
    sort( $cfvalues );
    echo c2c__format_custom( 'myfield', $cfvalues, '', '', '', ', ' );
    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Two questions:

    1. Are you reporting that the plugin worked at that link before and broke recently, or it never worked there (assuming you had that post listing before)?

    2. How are you generating that post listing? A plugin or a theme template? It appears as though it’s outputting a custom excerpt for posts without running filters, thus the plugin can’t act on the text.

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    I see what you’re getting at and can appreciate your desire: essentially being able to use WP MS to manage multiple sites via a single installation, but being able to have full conceptual separation between the sites (plugins, themes, users, etc). Sometimes you want to facilitate running multiple sites instead of a network.

    That said, WP is geared for the network approach. There are a number of implications of allowing duplicate accounts (username + email) (even just username). Supporting this is outside the scope of this plugin.

    I’m not convinced that this is viable with how things are architected now, but for that reason (and I like challenges) it’s worth investigating in the future.

Viewing 15 replies - 241 through 255 (of 409 total)