Forum Replies Created

Viewing 15 replies - 331 through 345 (of 409 total)
  • Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    You can’t have a dash as part of a variable’s name. Change $sample-image to $sample_image. Looks like you have to do that in three places.

    Also, your one line of code would be better as:

    <?php $sample_image = get_post_meta(the_ID(), 'sample-image', true); ?>

    What you are doing above is actually one of the reasons why I originally wrote the Get Custom Field Values plugin. All this code of yours:

    <?php $sample-image = get_post_meta($post->ID, 'sample-image', $single = true); ?>
    			<div id="sample-image">
    
    				<?php // if there's a thumbnail
    				if($sample-image !== '') { ?>
    					<p>
    						<img src="<?php echo $sample-image; ?>" />
    					</p>
    				<?php } ?>
    			</div>

    would just be this with the plugin:

    <div id='sample-image'>
       <?php echo c2c_get_custom('sample-image', '<p><img src="', '" /></p>'); ?>
       </div>

    (You could put the div tags in the call to the function too so that the sample-image div also doesn’t display if there is no sample image. But the way your original is coded, the div will always display, so my c2c_get_custom example behaves that same way.)

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    The fourth argument determines what to show if a post doesn’t have the custom field you’re looking for.

    For example:
    <img src="/wp-content/uploads/<?php echo c2c_get_custom("screenshot", "", "", "default_screenshot.jpg"); ?>" />

    The above code looks for the custom field “screenshot” and returns that; otherwise it’ll return the value “default_screenshot.jpg”. Of course, customize to suit your needs.

    Forum: Plugins
    In reply to: Creating Custom RSS Feed
    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    WordPress will create custom feeds on-the-fly for you if you provide additional query arguments:

    <a href="http://yoursite.com/feed/?cat=3,7,8,11">Feed 2</a>
    
    <a href="http://yoursite.com/feed/?cat=1,2,3,7,10">Feed 3</a>

    Obviously, modify the domain to match the root of your WP site (which, if running in a subdirectory, should also be included: i.e. http://your-real-domain.com/wordpress/feed/).

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    You can try out Stealth Publish.

    Forum: Fixing WordPress
    In reply to: Recent posts
    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    By default the plugin outputs each listed post within <li></li> tags. So you need something like:

    Recent Posts
    <ul>
    <?php c2c_get_recent_posts(3); ?>
    </ul>

    Or define your own format via the function’s second argument (read the docs for this on the abovementioned page).

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Try:

    <?php if ( in_category(20) ) { ?>
    <p>DO SOMETHING</p>
    <?php } else { ?>
    <p>DO SOMETHING ELSE</p>
    <?php } ?>

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Ok, do these also:

    1. Remove this line:
    echo "<li>";

    2. Change this line (near the very end of file):

    echo "$link</li>n";

    to this:

    echo "<li>$link</li>n";

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    jorgent: Try this: On line 215 of the plugin replace the line:

    else return;

    with

    else continue;

    (There is only one else return; line in the file.)

    See if that works for you and let me know. I’ll keep your user level exclusion idea in mind for the next version of the plugin (which if you confirm the above fix may be somewhat soonish).

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    I had written a plugin (heretofore unreleased) that allows you to do the above. I make no guarentees about it, but last I remember it worked. You can download the zip of it here. You can see the code for it here.

    Just unzip the .zip in your wp-content/plugins/ directory. Then edit it to identify (a) the custom fields you want to add to the “Manage Posts” page, and (b) the existing columns you want removed. Sorry, no admin screen for it at the moment.

    For example, using what you said, to add custom field to post listing, edit this variable like so:
    $custom_fields_to_show_in_listing = array(
    'country_name' => 'Country',
    );

    To remove existing columns (such as the author and category columns), change this relevent section:
    $listing_columns_to_remove = array('author', 'categories');

    Remember, you’re editing the plugin file to add/change the above code, not your templates or WP core files.

    Then, of course, activate the plugin.

    If you try it, let me know how (if) it works.

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    You’re calling the plugin from within “the loop”. Basically in the above you’re telling it to list the 20 most recent posts, doing so once for every post you have WP set to list (probably 10, as you mentioned the recent posts listings as being repeated 10 times). If you really want to use the above setup, don’t include the post loop:

    <?php if (have_posts()) : ?>

    <div class="post">

    Recent Posts
    <?php c2c_get_recent_posts(20); ?>

    </div>

    <?php else: ?>
    <?php _e('Sorry, dat konden we niet vinden!'); ?>
    <?php endif; ?>

    However, since you aren’t defining any customizations to the function call, you probably just want to use regular WP template tags.

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    get_currentuserinfo() is a replacable function, hence its inclusion in the pluggable-functions.php file. As such, the function needs to load AFTER all the plugins have been loaded (unlike in pre-1.5.1 versions where it got loaded BEFORE plugins).

    What this means for plugins is that you can’t call on get_currentuserinfo() in global space. I haven’t taken a look at the code for Exhibit, but that is my guess as to what it’s doing and why it’s now a problem.

    It’s very likely other plugins will be likewise affected.

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    There is a bug report on Mosquito related to this issue (which isn’t limited to just the <blockquote> tag: http://mosquito.wordpress.org/view.php?id=178

    The patch attached to that bug may not apply so cleanly as it was created months ago and the WP code has probably changed things up a bit since then, but the approach should still be valid.

    Forum: Plugins
    In reply to: Help with wp-phpmailer
    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Would your server also be a Windows server?

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    I assume by %URL% you meant %post_URL%. Well, I’m close to releasing a much-delayed update to the plugin. I could probably add a setting or two to allow truncation of titles. Would you be looking to truncate by word or number of characters? A good solution might be to allow truncation of any of the percent-substitution tag values. Hmm, I may just get this version out the door before I try that. There are enough new features in it as it is… 🙂

    Forum: Plugins
    In reply to: wpPHPMailer has me confused
    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Don’t reinstall WP on account of the plugin. Permissions might be set incorrectly for the plugin’s file(s) and/or directory. Do you have shell access to your plugin’s directory? If so, can you check owner and file permissions? What operating system is your server and what web server are they using?

Viewing 15 replies - 331 through 345 (of 409 total)