Forum Replies Created

Viewing 15 replies - 1 through 15 (of 44 total)
  • Thread Starter mrspabs

    (@mrspabs)

    nevermind. i was able to remove it the normal way.

    Thread Starter mrspabs

    (@mrspabs)

    Looks like Advanced Access Manager does what I need. Just posting the answer here in case someone else needs it.

    https://aamplugin.com/article/how-to-create-temporary-wordpress-user-account

    Thread Starter mrspabs

    (@mrspabs)

    Thanks

    mrspabs

    (@mrspabs)

    Thank you for this code, here is my adaptation of it!

    add_action('uwpqsf_form_bottom','insert_date_input');
    function insert_date_input($attr){
    		$html = '<div class="uwpqsf_class"><span class="taxolabel-2">Date Range</span>';
    		$html .= '<div><label><span style="display:block;">From </span> <select class="monthsearch" name="date[from-month]">   <option value="">--Select Month--</option><option  value="1">Janaury</option><option value="2">February</option><option value="3">March</option><option value="4">April</option><option value="5">May</option><option value="6">June</option><option value="7">July</option><option value="8">August</option><option value="9">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option></select>  <input name="date[from-year]" size="4" value="" class="yearsearch" type="text" placeholder="YYYY"></label></div>';//you can use select or other input type
    		$html .='</div>';
    		$html .= '<div class="uwpqsf_class">';
    		$html .= '<div><label> <span style="display:block;">To </span> <select class="monthsearch" name="date[to-month]">   <option value="">--Select Month--</option><option  value="1">Janaury</option><option value="2">February</option><option value="3">March</option><option value="4">April</option><option value="5">May</option><option value="6">June</option><option value="7">July</option><option value="8">August</option><option value="9">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option></select> <input name="date[to-year]" value="" class="yearsearch" type="text" placeholder="YYYY"></label></div>';
    		$html .='</div>';
    		echo $html;
    }
    
    add_filter('uwpqsf_deftemp_query','insert_date_to_query','',3);
    function insert_date_to_query($args,$id,$getdata){
    
    	 $args['date_query'] = array(
    		  'after'     => array(
    				'year' => $getdata['date']['from-year'],
    				'month' => $getdata['date']['from-month'],
    				'day' => '1'
    		  ),
    		  'before'    =>  array(
    				'year' => $getdata['date']['to-year'],
    				'month' => $getdata['date']['to-month'],
    				'day' => '31'
    		  ),
    		  'inclusive' => true
    	 );
    
    return $args;
    }

    Filters

    how do i get it to show what the user searched for in the search results. is there is way to get the “value” and “selected” to update on the search result page?

    • This reply was modified 9 years ago by mrspabs.

    Did you ever figure out how?

    Thread Starter mrspabs

    (@mrspabs)

    Figured it out

    <div style=”background: url(<?php
    if ( ” != get_the_post_thumbnail() ) {
    the_post_thumbnail_url(‘custom’);
    }
    else {
    echo get_bloginfo( ‘stylesheet_directory’ ) . ‘/img/blog-placeholder.jpg’;
    }
    ?> ); background-size:cover; background-position:cover;”>

    Thread Starter mrspabs

    (@mrspabs)

    Thanks! That helped a lot. I was able to write it like this and it works.

    <?php
    global $post;
    $cat_ID=array();
    $categories = get_the_category(); //get all categories for this post
      foreach($categories as $category) {
        array_push($cat_ID,$category->cat_ID);
      }
      $args = array(
      'orderby' => 'date',
      'order' => 'DESC',
    	'post_type' => 'post',
    	'numberposts' => 8,
    	'post__not_in' => array($post->ID),
    	'category__in' => $cat_ID
      ); // post__not_in will exclude the post we are displaying
        $cat_posts = get_posts($args);
    if ($cat_posts) {
      foreach ($cat_posts as $cat_post) {
        ?>
        <div class="col-md-3 text-center">
     <a href="<?php echo get_permalink($cat_post->ID); ?>">  <?php echo get_the_post_thumbnail( $cat_post->ID, 'medium' ); ?><br>
     <?php echo get_the_title($cat_post->ID); ?></a>
     </div><!--// col-md-3 -->
    <?php $counter++; if ($counter % 4 == 0) { echo '</div><div class="row">'; } ?>
        <?php
      }
    }
    ?>

    Just posting the resolution here for anyone else who needs it.

    <?php
    /*
        A loop field named "gallery" with sub-fields "slide_title", "upload" and a select called file_type.
    */
    $fields = CFS()->get('gallery');
    foreach ($fields as $field) {
        echo $field['slide_title'];
        echo $field['upload'];
        echo current($field[file_type]);
    }
    ?>

    Since the select field “file_type” returns an array, using current will allow you to display the first item in the array.

    This solution only works for a select box where only one item can be chosen.

    mrspabs

    (@mrspabs)

    Hi Don. Just wanted to followup. Thanks again for your replies.

    We changed the theme to Twenty Fifteen and we get the same error.

    Urivalet is a cool site, when I use it, I see that my redirect is indeed a 301 redirect even though the front end says 302. So I am think I am all set. Just thought you would want to know.

    Thread Starter mrspabs

    (@mrspabs)

    i think i figured it out. can someone confirm that I am right?

    <?php  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;  ?>
    <?php $the_query = new WP_Query( array( 'posts_per_page' => 2, 'pagination' => true, )); ?>
    <?php if ( $the_query->have_posts() ) : ?>
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
    <!-- stuff -->
    
    <?php endwhile; ?>
    
    <div class="nav-previous alignleft"><?php next_posts_link('Older posts', $the_query->max_num_pages ); ?></div>
    <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
    <?php else : ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    The code works, but I want to be sure that its all written correctly since I am trying to fix bad habits.

    Thread Starter mrspabs

    (@mrspabs)

    Oh i see what i did wrong

    the table is _postmeta, _wp_attached_file, remove the front slash from the meta value

    Thread Starter mrspabs

    (@mrspabs)

    PS I deactivated quick page post redirect plugin, and it fixed.

    Thread Starter mrspabs

    (@mrspabs)

    I removed the plugin and replaced it with this codea and it still happens, so its not the plugin.

    <ul>
    <?php
    global $post;
    $current_page_parent = ( $post->post_parent ? $post->post_parent : $post->ID );
    
    wp_list_pages( array(
         'title_li' => '',
         'child_of' => $current_page_parent,
         'depth' => '1' )
    );
    ?>
    </ul>

    +1

    Thread Starter mrspabs

    (@mrspabs)

    Oh i found it. I didn’t realize that your plugin made pages within the “pages” area of the dashboard. Thanks!

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