Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • I should note this was not a one-off fluke. I’ve done this about two or three times in the past, with the same success.

    For what’s it’s worth, here’s my input. I had a very small file (400k) that kept failing and timing out. I tried the following two steps, and it worked.

    1. Confirm that the permalink structure matches that of the old blog you are importing content from.

    2. If you press the “upload” button and the browser doesn’t respond after a reasonable amount of time, click it again.

    Somehow, that kick-started WordPress, and it imported the data as normal.

    After searching the 115 pages in the support forum, looking through the documentation, and reading through the FAQs, I have come up empty handed. So, I decided to write a solution myself. Here’s my contribution.

    In the folder for contact-form-7, navigate to the modules folder. Open up the select.php file, and scroll down to the following line (around line 92):

    $html .= '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . esc_html( $label ) . '</option>';

    My ammendant (overwrite) is as follows:

    //BOF AMMENDMENT
    if(strpos(esc_attr($value), "!optgroup") > -1) {
    	$exploded_value = explode('-', esc_attr($value));
    
    	$html .= "<optgroup label=\"" . $exploded_value[1] . "\">";
    } elseif(esc_attr( $value ) == "optgroup!") {
    	$html .= "</optgroup>";
    }
    //EOF AMMENDMENT
    else {
    	$html .= '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . esc_html( $label ) . '</option>';
    }

    To use this, set up a select menu as follows:
    !optgroup-Group 1 Name
    option
    option
    option…
    optgroup!

    What the code is:
    1. Looks at the first item, which has a prefix of !optgroup-.
    2. Creates an tag for <optgroup lable=”NAME_GOES_HERE”> where NAME_GOES_HERE is whatever you want it to be, as long as it doesn’t have a “-” hyphen. If you want to edit that, it’s right there in the code.
    3. Continues listing out the other options that you want in this group.
    4. Find optgroup!, and uses that a trigger to close off the current option group.

    You can use this to create as many option groups as you want in the list. Have fun, and let me know if this code presents any bugs.

    *helps.

    Gods, I’m tired. Thanks again. You saved me several hours of frustration.

    DUDE (you are a dude, right?)!!! You’re a genius! That last snippet you sent works perfectly, without any tweaking.

    So, if you’re going to rework the article, here’s my feedback:
    1. the code you say to put in functions.php works just fine, with those comment segments fixed.

    2. The new code for single.php (which you posted above) also works great without any changes.

    3. The code segment in archive/category.php has one hiccup, I think. When I use the following line:
    $permalink = add_query_arg('stayincat', get_query_var('cat'), $permalink);

    It doesn’t work for some reason. However, when I switch that second $permalink to get_permalink(), it functions properly.

    Thanks again! Hope that hopes. ??

    I’ll give that second one a shot. Thanks.

    Here’s the code I’m using on all three pages:

    index.php (functions as category.php in this case):

    if(is_category('9')) { //ONLY WANT THIS TO WORK IN SELECT CATEGORIES
    	$permalink = add_query_arg('stayincat', get_query_var('cat'), get_permalink());
    } else {
    	$permalink = get_permalink();
    }

    sidebar.php (read by single.php):

    <?php if($mam_global_stay_in_cat) { ?>
    <div class="navigation-box">
    	<div class="nav-prev"><?php next_post_link('%link', '&laquo;', 'true'); ?></div>
    	<div class="nav-index"><a href="<?php bloginfo('home'); ?>/category/portfolio/<?php echo $nav_index_category; ?>/">&laquo;&raquo;</a></div>
    	<div class="nav-next"><?php previous_post_link('%link', '&raquo;', 'true'); ?></div>
    </div>
    <?php } ?>

    functions.php has all of the other code and, as mentioned, seems to work fine without any errors.

    Thanks, I noticed that afterwards. Sometimes I jump the gun, you know. It looks like the code works fine now – I can uncomment all of those ECHO lines, and they output the data I’d expect.

    So, it looks like I have it working partially. The category page picks up the “stayincat” query string and passes it to the single posts. However, the individual posts do not seem to be picking up and reading the stayincat parameter.

    Is there something I’m missing? That one block of code for single.php looks a bit light.

    Sorry. I’m new to this. I obviously mean the line I incorrectly highlghted as “strong.”

    I see where you’re going with that, and it looks like it does exactly what I need. However, I’m at the part where the tutorial calls for adding code to my functions.php file.

    I’m getting an “unexpected T_STRING error” alert, which my server tells me is the below line in bold. Any ideas?

    function mam_previous_post_link_filter ($link='') {
    global $mam_global_stay_in_cat;
    //echo '
    <strong>PREV LINK BEFORE:' . htmlspecialchars($link) . '</strong>
    ';

    @vtxyzzy: I’m glad you clarified that. I was having the same problem.

    Do you know of how this would work when the posts are assigned to multiple categories? Or if it can be done at all? I’ve seen other people post similar questions in the forums, but with no response.

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