Forum Replies Created

Viewing 15 replies - 1 through 15 (of 34 total)
  • Forum: Plugins
    In reply to: Passing Variables via URL
    Thread Starter abovegrnd

    (@abovegrnd)

    Gah, so I solved this.

    It must have had something to do with using the query variable “attachment” — must already be in use or something.

    I simply changed it to “current_attachment” and now it works as advertised.

    -T

    Forum: Plugins
    In reply to: filtered search by category

    Glad I could help.

    I thought about doing it with a plug in as well, but I felt like it would be MORE work to customize something existing to have the level of control I needed, rather than to just code it all by hand.

    I also have a tendency to do things the hard way just because I like the challenge. J

    Forum: Plugins
    In reply to: filtered search by category

    I believe what you’re looking for is called “Faceted search”, i.e. the ability for people to not only input a search query, but also to filter it down by other existing criteria (categories, tags, etc).

    I actually just recently built this functionality for a client of mine — a real estate company — so it’s *fairly* fresh for me. But, since it was my first time doing something like this, I’m pretty sure that my code isn’t as clean as it could/should be.

    The basic outline of what you’ll need:

    1. Search box – this contains all of your custom variables. Whether they’re drop downs, check boxes, or links — mine were all hard-coded as check boxes with unique IDs

    2. Custom search results template – This is the other end; once the search form gets submitted, your search results page has to interpret the variables you passed through to determine how to filter it all down.

    Now, the best way (that I found) to accomplish all of this is just by passing the variables using a GET/POST method, and then interpreting these inputs on the other side.

    Like I said, my code is all done by hand and probably not the most efficient, but here’s what I did.

    Search box:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    As you can see, I also used the GET method here to figure out whether that variable had already been passed in on that page, and then check it if it had (so they wouldn’t have start fresh if they just wanted to change one variable).

    Further down, I created a loop and passed in the variables (again, this got super complex/tedious because of the way it had to function and that when CERTAIN boxes were checked, it meant I had to exclude parallel categories, but OTHER boxes were independent).

    Here’s me interpreting all of the variables and putting it together to figure out which categories to look in:

    [Code moderated]

    Like I have said multiple times, I may have SEVERELY over-complicated this solution. But, given my limited knowledge, I had to sort of hack it together. It works well, even though the code may not be the prettiest or well-optimized.

    Here’s the site for reference: https://rentinia.com/property-search?area=3&price=4&type=16&tag-dropdown=Any+Bedrooms&formSubmit.x=236&formSubmit.y=18&formSubmit=submit

    If you have any specific questions, I’ll try to help the best I can.

    -T

    EDIT: Oh, one more thing: I was also working with an EXISTING search functionality from another page template that was built on drop downs. So, that’s why there are a lot of redundant options (you’ll notice I’m looking for both numerical values as well as text-based values in a lot of cases).

    Unfortunately, I didn’t really have the ability to retroactively change the values from the existing drop down search, so I just had to patch it in and make it all work together.

    Forum: Plugins
    In reply to: Random Line Break?
    Thread Starter abovegrnd

    (@abovegrnd)

    Anyone have any ideas on this line break?

    Thread Starter abovegrnd

    (@abovegrnd)

    D’oh! I put the code in my test header rather than the live one. That worked like a charm. Thanks, Mark! I knew it was some simple function or “exit” strategy to get me out of the extra loops.

    Cheers!
    Tyler

    Thread Starter abovegrnd

    (@abovegrnd)

    Mark, thanks for the help. I put that in, but it’s still doing the same thing unfortunately. New code is as follows:

    <ul id="topnav">
        <li><a href="/category/features/" class="features">Features</a>
            <div class="sub">
                <ul>
                    <li><h2><a href="/category/features/culture/">Culture</a></h2></li>
    <?php
     global $post;
     $tmp_post = $post;
     $myposts = get_posts('numberposts=2&offset=0&category=588');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                <ul>
                    <li><h2><a href="/category/features/music/">Music</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=2&offset=0&category=586');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                <ul>
                    <li><h2><a href="/category/features/fashion/">Fashion</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=2&offset=0&category=587');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                <ul>
                    <li><h2><a href="/category/features/photographs/">Photos</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=2&offset=0&category=605');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
            </div>
        </li>
        <li>
        	<a href="#" class="news">News</a>
            <div class="sub">
                <ul>
    <?php
     global $post;
     $myposts = get_posts('numberposts=4&offset=0&category=196');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
            </div>
        </li>
        <li><a href="/category/reviews/" class="reviews">Reviews</a>
    <div class="sub">
                <ul>
    <?php
     global $post;
     $myposts = get_posts('numberposts=4&offset=0&category=198');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><?php the_post_thumbnail('review-cover-front'); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <div class="Clearer"></div>
     <?php endforeach; ?>
                </ul>
                </div>
        </li>
        <li><a href="/category/columns/" class="columns">Columns</a>
                <div class="sub">
                <ul>
    <li><h2><a href="/category/columns/pro-logic/">Pro Logic With Willie Green</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&offset=0&category=775');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                <div class="row">
                <ul>
    <li><h2><a href="/category/columns/first5/">Get Familiar</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&offset=0&category=439');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                </div>
                <div class="row">
                <ul>
    <li><h2><a href="/category/columns/geek-week/">Geek Thug: Technology Weekly</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&offset=0&category=936');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                </div>
                </div>
        </li>
        <li><a href="/category/blogs/" class="blogs">Blogs</a>
                <div class="sub">
                <ul>
    <li><h2><a href="/category/blogs/letter-from-the-editor/">Letter From the Editor</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&offset=0&category=776');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                <div class="row">
                <ul>
    <li><h2><a href="/category/blogs/psalm-one-blogs/">Psalm One Loves You More</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&offset=0&category=997');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
                </ul>
                </div>
                <div class="row">
                <ul>
    <li><h2><a href="/category/blogs/Words-I-Manifest/">Words I Manifest</a></h2></li>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&offset=0&category=1337');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
    <?php $post = $tmp_post; ?>
    <?php wp_reset_query(); ?>
                </ul>
                </div>
                </div>
        </li>
        <li><a href="/category/the-leak/" class="music">Music</a>
    <div class="sub">
                <ul>
                    <li><a href="/category/the-leak/singles/">Singles</a></li>
                    <li><a href="/category/the-leak/mixtapes/">Mixtapes</a></li>
                    <li><a href="/category/the-leak/albums/">Albums</a></li>
                    <li><a href="/category/the-leak/eps/">EPs</a></li>
                </ul>
                </div>
        </li>
        <li><a href="/forums/" class="forum">Forum</a></li>
    </ul>
    Thread Starter abovegrnd

    (@abovegrnd)

    After further testing it seems that it works with any other delimiter other than “-” or ” – “. So, it seems to have trouble picking up the dash in the middle, anyone have any idea why that might be?

    Thread Starter abovegrnd

    (@abovegrnd)

    Okay, I see your point.

    My next question is then, how do I correct the overlap on the first page?

    Thanks.

    It would be much easier to assess your issue with a link to the specific page that is giving you problems.

    Thread Starter abovegrnd

    (@abovegrnd)

    Hi.

    Thread Starter abovegrnd

    (@abovegrnd)

    Thanks for the insight iridiax. I’m not finding any funky quotes or anything. I looked at the codex you linked, but everything seemed in line according to that site.

    Thread Starter abovegrnd

    (@abovegrnd)

    Still annoyed.

    Thread Starter abovegrnd

    (@abovegrnd)

    Anyone wanna help me out with this? I would really appreciate it.

    Thread Starter abovegrnd

    (@abovegrnd)

    Still needing help on this

    Thread Starter abovegrnd

    (@abovegrnd)

    Wearitwell, you are the man. Nailed it. Thanks a lot man. URL is https://abovegroundmagazine.com — Check it out, independent hip hop on a new level. Thanks so much.

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