Terry Sutton (saltcod)
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Comments that seem fake/spammy but advertise nothingI too have been perplexed by this. Comments that have no links, don’t advertise anything, and really don’t say anything.
At least they used to try and sell you something, now it’s just gibberish.
Forum: Fixing WordPress
In reply to: How is the table of contents achieved on support.WP.com?Found a potentially helpful snippet from CSS-Tricks.
Forum: Fixing WordPress
In reply to: How is the table of contents achieved on support.WP.com?Wow—Fast reply! Thanks so much.
I’m actually hoping get posts instead of pages, using categories as the argument.
I guess there isn’t a
<?php wp_list_posts ('my_category'); ?>? If I just construct the content listing using query_post do you think I could still use the same approach (with #toc…etc..)?Thanks again for the quick, helpful reply.
Terry
Forum: Fixing WordPress
In reply to: Add code to the_content()I suspect this is another one of those easily explainable things.
If I try just a plain-text string in before
$dateit works fine. Like so:<?php $date = get_the_time('d-m-y'); $content = get_the_content() . "testing" . $date; echo apply_filters('the_content',$content); ?>But trying to put a link in place of the string “testing” doesn’t work:
<?php $date = get_the_time('d-m-y'); $content = get_the_content() . "<a href="#">test link</a>" . $date; echo apply_filters('the_content',$content); ?>So there must be something funny about not being able to put hypertext in there?
Forum: Fixing WordPress
In reply to: Add code to the_content()Thanks a million @vtxyzzy. Works perfectly now. This also gave me a great opportunity to learn about filters! So thanks for that too.
As if I haven’t asked enough questions today, if you know how I might turn the date into a clickable permalink, that would be A++!
I’ve tried a few versions of this, but none have worked so far.
<?php $date = get_the_time('d-m-y'); $content = get_the_content() . "<a href="<?php the_permalink(); ?>">$date</a>" ; echo apply_filters('the_content',$content); ?>I’d hoped that by just putting the permalink in before the date and turning it all into a link it would work….but no avail.
If you have any ideas, I’d love to hear them, otherwise, thanks a whole lot for helping with this today.
Terry
Forum: Fixing WordPress
In reply to: Add code to the_content()A ha! Interestingly, when I wrap it in php tags and put it in
sidebar.phpit finally works. Breakthrough!More experimentation and I’ll post back proper results.
Thanks.
Forum: Fixing WordPress
In reply to: Add code to the_content()Some of the code does work, however.
If I put this in instead:
$test_string = "Test string to see if the filter works"; $content = get_the_content() . $test_string ; echo apply_filters('the_content', $content);It prints the test string right at the top of the page.
Forum: Fixing WordPress
In reply to: Add code to the_content()Thanks for the apply vs. add explanation. I didn’t even realize there was an
apply_filters. Great.Sadly again, however, even with
get_the_time()the code isn’t doing as it should.To be completely clear, I have the following pasted as-is into
functions.php:$date = get_the_time('j-F-Y'); $content = get_the_content() . " $date. " ; echo apply_filters('the_content', $content);But still, it doesn’t modify anything.
Appreciate the help very much,
Terry
Forum: Fixing WordPress
In reply to: Add code to the_content()Hurm. Sadly that didn’t work. The content just comes out without the date.
I’ve been trying
add_filterinstead ofapply_filtersall along. Is there an easy way to explain the difference.Thanks for having a look at this.
Terry
Hold the phone.
has_post_format()works just fine. A rather stupid typo is to blame.Forum: Themes and Templates
In reply to: Can’t style the SearchbarSolved. I had to edit widgets.php (in wp-includes) and make sure I had input class=”button” before anything would work. Editing the searchform.php wasn’t doing anything. Strange.