Forum Replies Created

Viewing 15 replies - 1 through 15 (of 25 total)
  • Thread Starter nublooo

    (@nublooo)

    Update if anyone is interested.

    – found the filter pre_comment_content, which runs before any comment content is inserted into the db, but could not make it work with SimpleCAPTCHA. With more testing and seeing how the function returns I’m sure it’s possible but unfortunaltey I don’t have the time right now.

    So I came up with a hack:

    – Replaced htmlspecialchars() with esc_attr() to prevent double encoding

    – Added a simple str_replace to filter out backslashes when the form is refilled:

    $trans = array("\r" => '\r', "\n" => '\n');
    trim(strtr(str_replace('\\', '', esc_attr($_POST['comment1'])), $trans))

    This seems to work so far and will have to do until I find the time to get more into the pre_comment_content filter.

    Hope this helps if anyone is having the same issue.

    prw, what are you talking about? Maybe you’d like to re-read the question?

    This problem can occur when you are logged in to WP as an administrator and are viewing a post that is not published, but has the post_status set as a draft. This, combined with custom permalinks being set for posts (such as /%category%/%postname%), can cause wp-comments-post.php to go blank. I know this because I too have stared at the blank screen and didn’t know why the hell it would do that.

    There are quite a few themes which e.g. display five random posts in the sidebar or footer (hardcoded widget), and where the post’s status isn’t checked prior to retrieving it from the database. I think this might be the issue for a lot of you who posted here – scenario: you are logged in and view a post. Then you log out of WP in one browser tab, but don’t refresh the post in the other tab. When you try to post a comment like that, your “logged” cookie has already been nuked and you wouldn’t be seeing the post (draft) in the first place. That is why wp-comments-post.php ends up not being able to process the comment.

    I hope this helps some of you.

    Same problem here. The page says “Downloading update from http://wordpress.org/wordpress-2.7.1.zip”, but that doesn’t seem to be happening since the stops loading at one point, but nothing else happens.

    I’m having the same problem.

    Ryan, the conditional statement refers to the current page being the search results page, not to the search widget.

    Did anyone else come across this issue and might have a solution?

    Forum: Fixing WordPress
    In reply to: change wp url

    Ah, yes. I learned this the hard way. I had to update all custom fields manually for each post after switching servers. Each post had a post thumbnail, and the whole Media Library showed empty files although all images were in the same place.

    Too bad this page you link to, Samboll, isn’t highlighted and linked to in BOLD letters in the WordPress General Settings page. It should be. If only I had known this earlier!

    Thread Starter nublooo

    (@nublooo)

    bumppp 🙂

    Anyone having this problem too? Maybe a solution? Or an idea?

    Forum: Fixing WordPress
    In reply to: WP Search Results

    revlimiter,

    If you follow the link I pasted to the custom fields page on WP above, you can see how to implement thumbnails. It’s not that hard at all.

    An overview for you:
    – Upload an image that you want to serve as a thumbnail to a post, but don’t embed it in the post
    – Get the image ID from the Media Library in your WordPress Admin
    – Back in the post, create a custom field named “thumbnail” and as a value, enter the image ID
    – In your search PHP file, put the code taghaboy posted above in the wordpress loop where you want the thumbnail to appear. Replace “petit” with “thumbnail”
    – That’s it

    Just check out the link I pasted.

    Forum: Fixing WordPress
    In reply to: WP Search Results

    Hi taghaboy,

    Using a condition like you do is a good idea, I always check if a custom field exists also. In order to achieve your standard image, you can just use the same structure as in line 3 of your code.

    Line 5 would be like this:

    else { ?>
    *your no-img html markup*
    <?php } ?>

    BUT, 2 things:
    1.
    Consider writing the get_post_custom_values() in a variable right after the wordpress loop starts (before the POST div), and echoing that variable. In PHP, it is always faster to echo something that’s pre-stored in a variable than it is to call it inline. I would also say it is a sign of good and clean code.

    2.
    What I do and I would recommend you do also is having a default background image for that defined in CSS. Then you can just leave the ELSE part out and simply close your PHP code after line 4 of your code above. If no image is there, the call doesn’t display anything and the background image is viewable. Just make sure to define width and height of the img in CSS so that it keeps its size.

    That’s cleaner, results in less code, and you can always change everything from CSS instead of having to go through every instance of your PHP call when you need to change the path or something else.

    Hope that helped.

    Yes, same here. Not on WP MU though, but WP 2.6.1 and Plugin version 3.1.0.1 in FF. Blank page under the Admin menu.

    Memory usage was 13.62 MB, server limit is 40MB
    Exec time was 0.25s, server limit is 50.000s

    No errors show in debug mode.

    Are there only us three who are experiencing this annoying behavior?

    Any help or ideas or insights would be great. Thank you.

    Forum: Fixing WordPress
    In reply to: WP Search Results

    Glad to know it works revlimiter!

    To display thumbnails, you can make use of WP’s custom fields. I’d start here: http://codex.wordpress.org/Using_Custom_Fields

    It’s explained pretty well there.

    That’s a whole other topic though. I’d start a new thread for anything related to that.

    Cheers
    Nubloo

    Forum: Fixing WordPress
    In reply to: WP Search Results

    If you mean the number of pages the search results are spread across, then try using the global WP call $wp_query->max_num_pages – I’d write that value into your own variable first, like so:

    $maxpages = $wp_query->max_num_pages;

    And then you can play with it and echo it in with the Search Results:

    <?php echo $maxpages; ?>

    Is that what you mean?

    Cheers
    Nubloo

    Forum: Fixing WordPress
    In reply to: WP Search Results

    whooami,
    look above 🙂

    Forum: Fixing WordPress
    In reply to: WP Search Results

    Hi revlimiter,

    Do you need that JavaScript in your searchform? All of that onfocus and onblur. I’m not entirely sure if that’s the cause but try removing that and see if it still has the same URL structure.

    The input-text tag without JavaScript:

    <input type="text" class="text_input" value="To search, type and hit enter" name="s" id="s" />

    What the JS does is remove the text “To search, type and hit enter” from the search box when user clicks on it, and bring it back when user clicks out, and it’s an inline IF condition.

    I’d first try to find out if that is the cause at all. If it is, try outsourcing the JavaScript code to a .js file or at least outside of the form, and only calling it from the form (take a look at this example: http://www.fireandknowledge.org/archives/2006/11/03/clearing-fields-with-javascript/ )

    To carry the $postnum count on to following pages, my first thought would be using the global variable $paged which holds the current page number, something like this:

    <?php
    //Initialize $pagenum
    $pagenum = $paged;
    
    //Set 1st page to 1 instead of 0
    if($pagenum == ''){$pagenum = 1;}
    
    //Start checking which page is up
    if ($pagenum == 1) {
    
    //On 1st page start counting posts from 1
    $postnum = 1;
    } else {
    
    //On following pages start counting from 11, 21, 31, etc.
    $postnum = ($pagenum * 10) - 9;
    }
    ?>

    Not sure if this will work, I didn’t have time to test it. Give this a try and tell me if it works 🙂

    Very good!

    To change the heading, replace the above code with the following:

    <?php wp_list_pages('child_of=8&title_li=<h2>' . __('Mytitle') . '</h2>'); ?>

    …and change Mytitle to your preferred heading. That should do it 🙂

Viewing 15 replies - 1 through 15 (of 25 total)