Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Found my solution (below)

    function custom_user_profile_fields($user){
    ?>
    <script>
    (function($) {$(function() {
    	document.getElementById("send_user_notification").checked = false;
    	//JS HERE
    });})( jQuery );
    </script>
    <?php
    }
    //add_action( 'show_user_profile', 'custom_user_profile_fields' );
    //add_action( 'edit_user_profile', 'custom_user_profile_fields' );
    add_action( "user_new_form", "custom_user_profile_fields" );
  • Not sure I understand the question.

    You say that you want to order categories but you are adding the orderby statement to a post query.

    1) There isn’t any way using get_categories()/get_terms() to order terms by a CPT.

    2) There isn’t any way using WP_Query() to order posts based on a field that in not saved in as post meta for posts. In this case these values would be saved in term meta for the term.

    If your field is on the term then trying to short posts by a non existent meta key will result in no results found. When you specify the meta key the way you have it implies that the meta key must exist.

  • @d8yhn3 this is not an option in the plugin. This is something you need to add to the code where the link is generations by adding target="_blank" to the link element.

  • Thank you very much John. This pointed me in the right direction.

    For anyone wondering, I ended up adding a meta field to the newly created attachment from the upload using update_post_meta after form submission.
    And then pre-filtered the posts query on the upload.php and admin-ajax.php (both media library access points) for attachments without the meta field using pre_get_posts().

    Thank you! 🙂

  • You need to find where the link to the subscribe is generated in your template file and modify it to add the url query parameter for the course that is being shown.

    If you post code of where this link is added someone may be able to help you modify it.

  • You need to use a pre_get_posts filter and set a meta_query based on the value of the field for the logged in user.

  • Your second code will always loop though all the rows and set the $_POST value each time, always ending with the value set to the final row of the repeater. You need to somehow match them and that will only be possible if the start date value is unique.

    
    while (have_rows('course_info', $courseid) {
      the_row();
      if (get_sub_field('startdate') == $submitted_start_date) {
        $_POST['input_40'] = get_sub_field('location');
      }
    } 
    
  • Some possibilities off the top of my head.

    Duplicate post meta entries matching the post ID and meta key.

    Missing or incorrect ACF field key references in the meta table. These are stored under the meta key "_{$field_name}"

  • To exclude files from the media library display you must create a pre_get_posts() filter the removes them from the list.

    I don’t remember all of the details of doing this,, but it will require having some way to determine that the files were uploaded through the specific form. Possibly by creating a custom field for files that is set.

    There are many examples of doing this, for example this one only shows files uploaded by the current user https://wordpress.stackexchange.com/questions/76771/how-can-i-hide-media-library-images-from-general-users

  • People still use Jquery?

  • Hi, does my precisions help to see question ?
    Best regards,
    Law

  • I don’t see anything wrong with the original location rules

    Taxonomy is equal to category should put the fields on the term editor page when ediging any category.

    What other plugins are you using. The only thing I can think of if it is adding fields to other categories is some type of conflict.

  • Serving as an update to my reply from yesterday, I thought that since adding the fields to only the Taxonomy -> Category was too general, increasing the specificity with an addition Location option would be the best next move. But everything gets completely removed. @hube2 would you have any other recommendations? Or is this an actual bug?

    Increasing Location specificity
    I’ve also tried with Post Taxonomy instead of Post Category:
    Increasing Location specificity with Post Taxonomy
    No fields added to default category page
    Also no fields added to custom category page

  • A non-JS option:
    Just swap out ‘company_detail’ for the name of your WYSIWYG field.
    And set/alter the length of the excerpt by changing the ’32’

    Nice and easy solution. Thanks for posting this.

  • Hey John,

    I’m using archive.php which I want to use as a generic for every archive. In this case /review-series/reviewed-on-vhs/ is the URL with review-series being detected with is_tax() triggering the if statement.

    The page works great for everything but this featured image thing. I can test for what type of archive is requested and customize my header. I can write my own $wpdb query to get what I want.

    I had to create a page describing my issue because ACF’s ticket system rejected it as spam 🤪 but you can see more details there:

    http://ex.clubsidedev.com/acf-problem.html

    Thanks again for your insights,
    Chris

  • What template file are you making changes to. I’m assuming “taxonomy-review-series.php”. I’ve never used get_queried_object_id(), and I learned something new today. I generally do something like

    
    $queried_object = get_queried_object();
    $value = get_field('field_name', $queried_object);
    

    If you are working in a template file that is showing a specific term in a taxonomy then this should work.

  • Thanks for the info John, unfortunately neither your code nor the linked page work.

    This has been the most frustrating thing for me as a SQL developer for decades, stuff that should be easy is over complicated by WordPress.

  • What version of ACF are you using?

    The latest version of ACF does not have a “Taxonomy Term” location rule, only a “Taxonomy”. The doc is old. Choose “Taxonomy is equal to {the taxonomy you want the fields on}”

  • The issue is that you have added a filter specifying 2 arguments to be passed but your function requires 3 arguments.

    
    // 4th parameter is number of args to pass = 2
    add_filter('acf/fields/taxonomy/query/key=field_62d02ad58c59f', 'my_acf_fields_taxonomy_query', 10, 2);
    // function requires 3 args
    function my_acf_fields_taxonomy_query( $args, $field, $post_id ) {
        // Order by most used.
        $args['parent'] = 0;
        
        return $args;
    }
    
  • Thanks. Years after I had time to go back to this project.
    WP_Query did the trick:

    	
            date_default_timezone_set("Europe/Zurich");
    	$dateNow = date('Y-m-d H:i:s');
    
            $args = array(
    		'post_type' => 'veranstaltungen',
    		'post_status' => 'publish',
    		'order' => 'DESC',
    		'orderby' => 'meta_value',
    		'meta_query' => array(
    			array(
    				'key'           => 'event_date',
    				'compare'       => '>=',
    				'value'         => $dateNow,
    				'type'          => 'DATETIME',
    			),
    		),
    		'numberposts' => -1,
    	);
    
    	$query = new WP_Query($args);
    
    	$posts = $query->posts;
    
  • Hi,

    Sorry for being not clear enough.

    I wish to filter posts, and more generally content, according to criteria of the current logged in user :
    If he has *this situation*, he can see *this*…

    My question is restricted to the criteria situation (which is an ACF added for each user, filled in at user subscription) :
    If the value of the situation is F, so the current logged in user can see this…

    And in my code, I just need the synthax to add this criteria “situation = F for the current logged in user” (starting with &&...)

    How could I do ?

    Thanks a lot,

    Kind regards,
    Law

  • Sorry, the picture not work. Here is the link.

  • What exactly are you fitering? Posts? Other users?

    Your question is not clear, need more detail.

Viewing 25 results - 4,176 through 4,200 (of 21,340 total)