chadrew
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: get_posts sorting by event date using meta_compareIt seems I managed to solve all these issues (whoa) so I’d like to leave this information for future generations.
First of all, I needed to convert all “M j, Y” dates in the custom fields into timestamps. I ran the following code through WordPress:
<?php $postslist = get_posts('numberposts=-1&order=ASC&meta_key=final'); foreach ($postslist as $post) : $naujas = strtotime(get_post_meta($post->ID, 'final', true)); update_post_meta($post->ID, 'final', $naujas); endforeach; ?>…Because I don’t know MySQL 🙂
Second, and I haven’t managed to find this in Codex anywhere, is that I’m supposed to use
meta_value_numto sort instead ofmeta_value. This way WordPress won’t think that 9 is more than 30!Modified code:
<?php $postslist = get_posts('numberposts=-1&order=ASC&meta_key=final&meta_compare=>=&meta_value=' . time() . '&orderby=meta_value_num'); foreach ($postslist as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br /> Event date: <?php echo date("F d, Y",get_post_meta($post->ID, 'final', true)); ?></li> <?php endforeach; ?>You’re welcome, future generations.
Forum: Plugins
In reply to: [Random Posts Widget] [Plugin: Random Posts Widget] Random posts widget errorExactly the same problem here.
Forum: Hacks
In reply to: Comments Form Advanced Coding (php)Very interesting, I was just looking for a way to make forum users able to comment on WordPress posts, without messing with duplicate databases and bridge plugins. Does this work by checking for PHPBB cookie?
I’ll definitely be trying this 🙂
Forum: Everything else WordPress
In reply to: Best "base" themes for making your own?Thanks, it definitely looks interesting. Although I see it uses CSS grids, something else I have never worked with. (Maybe it’s time I learned though).
I’m not sure if this helps, but yarpp-template-thumbnail.php checks for has_post_thumbnail function. As explained in the link below, your theme has to support post thumbnails – and the post has to have a thumbnail as well.
http://codex.wordpress.org/Function_Reference/has_post_thumbnail
IF both of these things are true, then I suppose it’s a problem with the plugin.
Have you tried changing YARPP options? Namely, “Relatedness options” and pick “Categories: require at least one category in common”.
Thanks a lot for the explanation. I guess I misunderstood the difference between garbage collection time and expiry time. But everything is clear now 🙂
Forum: Everything else WordPress
In reply to: Suggestions From Community About Pitfalls Of Open Comments?This is probably obvious, but you should get the Akismet plugin. It’s great for stopping most of the obvious, automated spam. If you still get bad comments after that, you can enable the setting which puts all first time commenters through approval first (after which they can post further comments instantly), but obviously that would add more work for you.
If you are using yarpp-template-list.php, you have to edit yarpp-template-list.php 🙂
Well, if you’re not using a template, it should be right after “Before / after related entries” and “Before / after each related entry”.
Forum: Everything else WordPress
In reply to: How to Get Credit from Google for Blog Comments?Normally you won’t get any SEO benefits because most WordPress blogs add “rel=nofollow” to comment links (and rightly so). And I don’t think Google assigns much value to comment or forum links these days, even if they don’t have nofollow on them.
Forum: Fixing WordPress
In reply to: How I can unlike my post title?Well, the problem is if you paste it in here the hyperlink becomes active and we can’t see it. But basically I guess you should leave only this:
<h3 class="entry-title"><?php the_title() ?></h3> <span class="entry-comments"><?php comments_number() ?></span>Forum: Fixing WordPress
In reply to: How I can unlike my post title?Are you missing something there? Put the code between
backticksI would use YARPP custom templates and put the code limiting the title length there. So, first make sure that in YARPP options you’re set to use custom templates. For example, “yarpp-template-example.php”. Then open that file in your theme editor and find this part:
<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><!-- (<?php the_score(); ?>)--></li>Replace with:
<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php echo substr(get_the_title(), 0, 40); ?>...</a><!-- (<?php the_score(); ?>)--></li>I’m no expert but this should work…
What’s in your YARPP options? (yoursite.com/wp-admin/options-general.php?page=yet-another-related-posts-plugin/options.php)
See “Before / after related entries”, first field should be something like:
Gerelateerde berichten <ul>
Second field:
</ul>Then in “Before / after each related entry” it should be:
<li>and</li>And in this case “Display using a custom template file” should be unchecked, unless you edit that file accordingly as well.