WordPress.org

Ready to get started?Download WordPress

Forums

How can i display the categories i want in checkbox ( ajax results) (4 posts)

  1. TataVostru
    Member
    Posted 1 year ago #

    I am searching on web how to build a search field with checkbox ( filter field )

    Example : http://tvpedia.org/?gen=aventura&tara=sua

    this is probably a confusing title of my question, please see the link link: http://www.linde.diviziatm.ro

    In the administration area i have post_type - Locatii with categories,the categories of post type are: Timisoara, Muntenia...and so on

    If i check Banat and Muntenia i want to retrive the content from Banat and Muntenia(post that are in that categories).

    In Locations by region - are the checkbox simple

    <div class="regiuni_ch">
    <div class="reg_c"><input type="checkbox" name="banat" value="Banat"  id="cntGHIRODA" onmouseout="mapBlur('Timisoara','ro');" onmouseover="mapHighlight('Timisoara','ro');" /><span class="reg_t">Banat</span></div>
    <div class="reg_c"><input type="checkbox" name="muntenia" value="Muntenia" /><span class="reg_t">Muntenia</span></div>
    <div class="reg_c"><input type="checkbox" name="crisana" value="Crisana" /> <span class="reg_t">Crisana</span></div>
    <div class="reg_c"><input type="checkbox" name="bucovina" value="Bucovina" /> <span class="reg_t">Bucovina</span></div>
    <div class="reg_c"><input type="checkbox" name="maramures" value="Maramures" /><span class="reg_t"> Maramures</span></div>
    <div class="reg_c"><input type="checkbox" name="transilvania" value="Transilvania" /><span class="reg_t"> Transilvania</span></div>
    <div class="reg_c"><input type="checkbox" name="moldova" value="Moldova" /><span class="reg_t">Moldova</span></div>
    <div class="reg_c"><input type="checkbox" name="dobrogea" value="Dobrogea" /> <span class="reg_t">Dobrogea</span></div>
    <div class="reg_c"><input type="checkbox" name="oltenia" value="Oltenia" /> <span class="reg_t">Oltenia</span></div>
    </div>

    In Locaţii după regiuni i have:

    <div class="ti"><b>Locaţii după regiuni</b></div>
    <div class="linie"></div>
    <?php $args = array(
        'show_option_all'    => '',
        'orderby'            => 'ID',
        'order'              => 'ASC',
        'show_count'         => 0,
        'hide_empty'         => 0,
        'use_desc_for_title' => 1,
        'child_of'           => 92,
        'feed'               => '',
        'feed_type'          => '',
        'feed_image'         => '',
        'exclude'           => '',
        'exclude_tree'       => '',
        'include'            => '',
        'hierarchical'       => true,
        'title_li'           => __( '' ),
        'show_option_none'   => __('Nici o categorie'),
        'number'             => null,
        'echo'               => 1,
        'depth'              => 0,
        'current_category'   => 0,
        'pad_counts'         => 0,
        'taxonomy'           => 'locatie',
        'walker'             => 'Walker_Category'
    ); ?>
    <div class="regiuni">
    <ul>
    <?php wp_list_categories( $args ); ?>
    </ul>
    </div>

    Anny sugestion on how to made this woud be apreciate. Thanks

  2. JungleSpace.net
    Member
    Posted 1 year ago #

    You can start by using Jquery. It is a javascript library which has an ajax function.

    http://api.jquery.com/jQuery.ajax/

    Your request needs to be send to http://www.domain.com/wp-admin/admin-ajax.php

    https://codex.wordpress.org/AJAX_in_Plugins

  3. TataVostru
    Member
    Posted 1 year ago #

    how can i delete this post?

  4. how can i delete this post?

    You can't and we don't delete topics without a good reason such as an extreme case.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags