Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter seancho

    (@seancho)

    Hi Lester, Thanks for the quick reply. I’ve emailed you a link to the site.

    Thread Starter seancho

    (@seancho)

    Thanks, esmi. Your advice turned out to be good. I was skeptical, but when I did the upgrade with plugins deactivated I discovered that a plugin conflict with 3.5.1 was permanently breaking the tags, even after the plugin was deactivated (post-upgrade).

    If someone with the same issue finds this thread and is running ‘multi-page toolkit’, then that is your problem. Solution is here:

    http://wordpress.org/support/topic/breaks-category-and-tags-permalinks-in-351?replies=2

    Thread Starter seancho

    (@seancho)

    Yes

    Thread Starter seancho

    (@seancho)

    I ran the auto-update from inside the WP admin. Everything backed up. I did not disable all plugins before upgrade. I’ve never considered doing that when upgrading.

    Anyway, WordPress reported upgrading ok. It is just that now tag pages are 404.

    Anyone every encounter something like this?

    Forum: Fixing WordPress
    In reply to: Styles disappeared
    Thread Starter seancho

    (@seancho)

    nvm, I just reimported the files again.

    Thread Starter seancho

    (@seancho)

    Well, I’ve got it working. This works:

    <?php function islink($key){
    global $post;
    $key2 = $key.'_link';
    $meta = get_post_meta($post->ID, $key2, true);
    if($meta != 'null')
    echo '<a href="',the_field($key2),'">',the_field($key),'</a>';
    else
    echo the_field($key);
    }?>

    I have to use the string ‘null’ instead of ”. I don’t understand it, but at this point I’ll take the working code. There’s something I’m not understanding about get_post_meta.

    Thread Starter seancho

    (@seancho)

    Makes sense. So in my code, I have now brought $post within the scope of the function:

    <?php function islink($key){
    global $post;
    $key2 = $key.'_link';
    $meta = get_post_meta($post->ID, $key2, true);
    if($meta != '')
    echo '<a href="',the_field($key2),'">',the_field($key),'</a>';
    else
    echo the_field($key);
    }?>
    
    <?php islink('dad');?>

    But it doesn’t work. This function returns:

    <a href="">Dad</a>

    instead of the string ‘Dad’ when the field dad is set to ‘Dad’ and the field dad_link is unset, ie null.

    Why? When dad_link is null the function should return ‘Dad’.

    Thread Starter seancho

    (@seancho)

    Well, I’m not entirely understanding all this. Scope is a new concept. Putting global $post; in the function brings $post into scope, no? But it’s still not behaving as I wish.

    Late. I will have to read up on all this tomorrow!

    Thread Starter seancho

    (@seancho)

    OK, so responding to the 2nd suggestion. As I say above, even with global $post it still doesn’t work. And I’ll have to look up what that does.

    I’m using a function because there are 16 places I need that code. So the source code is much lighter and cleaner this way. And besides, it’s my first crack at a php function, so I can’t back down now!

    Thanks for info on global $post. But I’m still not there, yet.

    Thread Starter seancho

    (@seancho)

    Edit: posted before reading the response above…

    Weird.. When I include global $post; it is all links again — all null values for dad_link are ignored and links with a missing URL result – <a href=""> So this is the new code:

    <?php function islink($key){
    global $post;
    $key2 = $key.'_link';
    $meta = get_post_meta($post->ID, $key2, true);
    if($meta != '')
    echo '<a href="',the_field($key2),'">',the_field($key),'</a>';
    else
    echo the_field($key);
    }?>

    Strangely, the following code does work, and I don’t understand why..

    <?php
    $key = 'dad';
    $key2 = 'dad_link';
    $meta = get_post_meta($post->ID, $key2, true);
    if($meta != 'null')
    echo '<a href="',the_field($key2),'">',the_field($key),'</a>';
    else
    echo the_field($key);
    echo get_post_meta($post->ID, $key2, true);
    ?>

    I can run that code on the same page as the other, and it correctly switches between plain text and link text for the dad field while the other does not. The echo at the end returns null and 92, which is the ID of the linked page.

    Anyone understand what is going on?

    Thread Starter seancho

    (@seancho)

    Ha. Outsmarted myself. It’s a setting in the Multisite admin 🙂

    For the next dummy that runs into this:

    In Network admin, go to Settings and scroll down to Upload Settings at the bottom.

    Thread Starter seancho

    (@seancho)

    Thank you for that. Beer is good =)

    It’s been a long evil slog through Godaddy hell, but all the sites are loading in their new neighborhood. Very happy about that. The last hurdle was a missing .htaccess file that broke redirection and almost made me insane.

    BTW, there actually were some references to the old file system in the database…about 10, one for each site, and a few extra to boot. I have no idea what they were for, but I changed them over to the new. Plugins, perhaps?

    Thread Starter seancho

    (@seancho)

    Yup, apparently I was missing some files. Reupped 3.2.1 and it now works. Thanks for the suggestion.

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