Querying Wordpress items that contain special characters or numbers

0

Hello, I would like to know how I can change the code below so that it can also query, and the assembly of a listing with items that are not initialized by A to Z characters (such as special characters # $% & ^, numbers and etc.). The current code only performs the filtering of items with characters A through Z through the $_GET['letra'] variable, and creates the list according to the link clicked in the alphabetical list field from A to Z placed at the top of the script with letter link concerned.

I would like to have only the items that do not have Initials A to Z listed when clicking the # button.

Alphabet listing function from A to Z

function doo_glossary( $type = 'all') {
    // main codition
    if( DOO_THEME_GLOSSARY != false ) {
        echo '<div class="letter_home"><div class="fixresp"><ul class="glossary">';
        echo '<li><a class="lglossary" href="'.get_the_permalink().'">All</a></li>';
        for ($l="a";$l!="aa";$l++){
            echo '<li><a class="lglossary" href="'.get_the_permalink().'?letra='.strtoupper($l).'">'. strtoupper($l). '</a></li>';
        }
        echo '</ul></div></div>';
    }

Paging area

 <?php
    /*
    Template Name: DT - Series Legendadas
    */
    get_header();
    echo '<style>
        #dt_contenedor {
            background-image: url('.get_option('dt_fundo_site').');
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-size: cover;
            background-position: 50% 0%;
        }
    </style>';
    doo_glossary('tvshows');
    global $user_ID;
    $dt = isset( $_GET['get'] ) ? $_GET['get'] : null;
    echo '<div class="module"><div class="content">';
    get_template_part('inc/parts/modules/featured-post-tvshows');
    echo '<div id="archive-content" class="animation-2 items calendario">';
    // Ordenar em ordem alfabetica
    global $wp_query;
    $pages = $wp_query->max_num_pages;
    $first_char = $_GET['letra'];
    $postids=$wpdb->get_col($wpdb->prepare("
    SELECT      ID
    FROM        $wpdb->posts
    WHERE       SUBSTR($wpdb->posts.post_title,1,1) = %s
    ORDER BY    $wpdb->posts.post_title",$first_char)); 

    if (isset( $_GET['letra'] )) {
    query_posts(array(
        'post__in'      => $postids,
        'posts_per_page' => $pages,
        'caller_get_posts'=> 1,
        'paged' => $paged,
        'post_status'   => 'publish',
        'post_type'     => array('tvshows'),
        'meta_key'      => 'tipo_de_media',
        'meta_value'    => 'Series Legendadas',
        'order'         => 'ASC',
        'orderby'       => 'title'
    )); } else {

    query_posts(array(
        'posts_per_page' => $pages,
        'paged' => $paged,
        'post_type'     => array('tvshows'),
        'meta_key'      => 'tipo_de_media',
        'meta_value'    => 'Series Legendadas',
        'order'         => 'ASC',
        'orderby'       => 'title'
    ));

    }
    if (have_posts()) {
    echo '<header><h1>'. __d('Series Legendadas'). '</h1><span>Total ('.$wp_query->found_posts . ')</span></header>';
        while (have_posts()) {
            the_post();
            get_template_part('inc/parts/item');
        }
    }else { echo '<header><h1>'. __d('Series Legendadas'). '</h1><span>Total ('.$wp_query->found_posts . ')</span></header>';
    echo '<div class="wp-content">
    <blockquote><p>No momento essa seção esta sem nenhum conteúdo, em breve ela sera ativada.</p></blockquote>
    </div>'; }
    echo '</div>';
    if ( function_exists("pagination") ) {
        pagination();
    }
    echo '</div>';
    get_template_part('inc/parts/sidebar');
    echo '</div>';
    get_footer();
    
asked by anonymous 08.10.2018 / 20:47

0 answers