Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • I found a workaround that might help the rest of you.

    First, I save a draft of a new post and mentally note its title slug. I then manually insert the title into the preview URL path.

    Let’s say I write a post called “New Post”. The Permalink on my site would be:
    https://www.example.com/new-post/

    WP generates the following URL for the preview:

    https://www.example.com/?p=123&preview=true

    This returns me to my homepage. However, if I insert the post title slug into the path, for example:

    https://www.example.com/new-post/?p=123&preview=true

    Then I get the preview!

    I assume that the problem has something to do with the way my .htaccess file uses rewrite rules, but it’s beyond my ability to figure it out. Anyone have any ideas?

    I have the same problem running 2.6.1.

    WordPress address is https://www.example.com/wp/

    Blog URL set to https://www.example.com/

    Preview link is https://www.example.com/?p=%5Bnn%5D&preview=true takes me to the main page of the site (not the blog page).

    Previews used to work fine before I moved the blog URL out of the wp directory.

    I created a page in wp called “blog” and have my loop on that page. This I link to from the sites main page with https://www.example.com/blog/

    The site’s main page is https://www.example.com/index.php which just shows the latest post exerpt and other static content.

    Everything works fine except for the post preview. Anyone have any ideas.

    Thread Starter milo2man

    (@milo2man)

    Let me try to explain. When the search query returns a result, the conditional tag in_category(55) works to send the search to the search results page for that category, search-art.php.

    However, if the search query returns nothing (no results) then the conditional tag does not work (I guess because no results are actually in category 55) and the results page defaults to that for the blog.

    How do I write the conditional tag so that it works even when there are 0 results?

    I am breaking my head on this one, please help!

    Forum: Fixing WordPress
    In reply to: regex help
    Thread Starter milo2man

    (@milo2man)

    Thanks for the help. I tried these and finally managed to get it to work using

    RewriteRule blog/([A-Za-z0-9-]+)/$ /$1/ [R=301,L]

    The problem was the missing / after each expression.

    Thread Starter milo2man

    (@milo2man)

    Problem resolved. Had nothing to do with corporate firewall. The ShareThis plugin was causing the pages not to display in IE6.0.

    After deactivating the plugin, everything works fine.

    Anyone else have similar experience with ShareThis?

    Thread Starter milo2man

    (@milo2man)

    Ok, I’m getting a bit closer. I found this here.

    Redirecting a working URI to a new format

    Here’s a curly one. Let’s say, for example, that we’ve got a set of working URLs that look like this: /index.php?id=nnnn. However, we’d really like to change them to /nnnn and make sure search engines update their indexes to the new URI format. First, we’d have to redirect the old URIs to the new ones so that search engines update their indexes, but we’d still have to rewrite the new URI back to the old one so that the index.php script would run. Have I got your head spinning?

    The trick here is to place into the query string a marker code that will not be seen by visitors. We redirect from the old link to the new format only if the “marker” is not present in the query string. Then we rewrite the new format link back to the old format, and add a marker to the query string, using the QSA flag to ensure we’re not eliminating an existing query string. Here’s how it’s done:

    RewriteCond %{QUERY_STRING} !marker
    RewriteCond %{QUERY_STRING} id=([-a-zA-Z0-9_+]+)
    RewriteRule ^/?index\.php$ %1? [R=301,L]
    RewriteRule ^/?([-a-zA-Z0-9_+]+)$ index.php?marker&id=$1 [L]

    Here, the original URI, https://www.example.com/index.php?id=nnnn
    does not contain the marker, so it’s redirected by the first rule to https://www.example.com/nnnn with a HTTP 301 response. The second rule rewrites https://www.example.com/nnnn back to https://www.example.com/index.php?marker&id=nnnn, adding marker and id=nnnn in a new query string; then, the mod_rewrite process is started over.

    In the second iteration, the marker is matched so the first rule is ignored and, since there’s a dot character in index.php?marker&id=nnnn, the second rule is also ignored … and we’re finished!

    So, following this I changed my .htaccess to include:

    RewriteEngine On
    RewriteBase /blog/
    
    RewriteCond %{QUERY_STRING} !marker
    RewriteCond %{QUERY_STRING} cattag=([-a-zA-Z0-9_+]+)
    RewriteRule ^/?category/blog/$ %1/? [R=301,L]
    RewriteRule ^/?([-a-zA-Z0-9_+]+)$ /category/blog/?marker&cattag=$1 [L]

    The first rule does succeed in redirecting

    https://www.example.com/blog/category/blog/?cattag=events

    to

    https://www.example.com/blog/events/

    in the browser, but it returns a 404 error.

    I can’t seem to make the second rule rewrite the pretty link back to the original format for WP to find the resource. There is no . in my URL like in the example, so it is probably not being ignored as it shoudl be???

    I must be making a simple syntax error as I tried to adapt it from the poster’s original code. Can anyone help me get the second rewrite rule correct?

    Thread Starter milo2man

    (@milo2man)

    Thanks for this tip. I did exactly as you suggested, but the link still comes up as:

    https://www.example.com/blog/category/blog/?cattag=events

    Any ideas?

    Thread Starter milo2man

    (@milo2man)

    Thanks for the tip. This makes sense. I have compared the site’s main /index.php (which the customer can see) and the /blog/index.php (which he cannot) and found some differences. I am not sure which of the following are even needed by the blog???

    <head profile="https://gmpg.org/xfn/11">

    I don’t want my blog to be listed in some friends network. Can I safely delete this?

    I also noticed that there are two meta name=”keywords” tags, one I created manually and one generated automatically by the Simple Tags Plugin. Is this a problem?

    <base href="https://www.example.com/" />
    Exists on blog pages but not on the static pages outside the directory /blog

    Then there’s this:
    ‘<meta name=”generator” content=”WordPress 2.6.1″ /> <!– leave this for stats –>’

    <link rel="pingback" href="https://www.example.com/blog/xmlrpc.php" />

    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://www.example.com/blog/xmlrpc.php?rsd" />

    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://www.example.com/blog/wp-includes/wlwmanifest.xml" />

    Finally there’s the ShareThis widget which I do want to use.

    <script charset="utf-8" type="text/javascript" src="https://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=...

    What of all this can I safely delete???

    Thread Starter milo2man

    (@milo2man)

    Problem solved. There was a problem with the tdotf_the_tags when used on category pages. Thanks to this post I was able to solve the problem.

    In the tdotf.php file, I replaced the code beginning on line 399:

    function tdotf_the_tags( $before = '', $sep = '', $after = '' ) {
      global $tdotf_tag_get_var,$cat;
      if(is_category() && isset($tdotf_tag_get_var)) {
        $tags = get_the_tags();

    with the following:

    function tdotf_the_tags( $before = '', $sep = '', $after = '' ) {
      global $tdotf_tag_get_var,$cat;
      if ( ! $cat ) {
        $category = get_the_category();
        $cat = $category[0]->cat_ID;
      }
      if(isset($cat) && isset($tdotf_tag_get_var)) {
        $tags = get_the_tags();

    and this did the trick. One thing to note is that tdotf_the_tags was misspelled in the original file (as tdof_the_tags). I suppose either spelling would work, but I changed it to tdotf_the_tags for consistency.

    Thread Starter milo2man

    (@milo2man)

    Thanks MichaelH

    I tried the suggestions on the thread https://www.ads-software.com/support/topic/144220 and with the help of the Sensitive Tag Cloud plugin was able to get my home page to only show tags from posts in the blog category.

    However, the page with book reviews is showing the same tags (from the blog category) and not from the book review category.

    Anyone else have this issue with the sensitive tag cloud plugin? Works on home page but not on other pages?

Viewing 10 replies - 1 through 10 (of 10 total)