Tag Info

New answers tagged

1

You're close - couple of things: $field is an array representation of the field, so you need to use $field['name'] which is the name of the field. get_field will format the value unless you set the third argument to false - we want the ID, not the post object/URL (or whatever setting you configured for your field return value) Your code won't delete the ...


1

In this situation I would use the page as a placeholder to configure the sidebars, even though WordPress will completely ignore it on the front end. Just add the page, make sure the slug is trainings, let the client set it up as they need, and then in your template: if ( $trainings_page = get_page_by_path( 'trainings' ) ) { $acf_sidebars_data = ...


0

Simply you need to replace the_field('video') with get_field('video'). Why? Because according to ACF documentation; get_field($field_name, $post_id, $format_value) Returns the value of the specified field. Whereas on the other hand the_field($field_name, $post_id) Displays the value of the specified field. (this is the same as “echo ...


0

@David explained why your code doesn't work and sketched out a solution (use save_post instead). However, you can "chain" hooks together so that you should still be able to use the transition filters to control execution: function create_recurring_posts( $ID, $post ) { add_action( 'save_post', function() { // debug, since I don't have a ...


0

Your action is triggered in wp_transition_post_status() which gets called by wp_insert_post() before the action save_post is triggered. save_post is the typical action to handle custom fields. ACF also works on this. Basically you have to wait until ACF is done with its stuff, means you'll have to hook to save_post with a priority > 10 or better use ...


-1

Just make the field type as text and it will work


0

As per the ACF documentation, you must pass either the term and term ID or the term object to the get_fields() function for a taxonomy. So in your case, you would replace $tag_image = get_field('tag_image'); with: $tag_image = get_field('tag_image', $term);


2

Simply use get_sub_field("session_speaker"); function to retrieve that data. As you've said this is a relational field, it will return an array of post objects according to the docs. In order to get data from each speaker, you need to loop through the resulting array. Example: $speakers = get_sub_field("session_speaker"); if ($speakers && ...


0

After you have inserted the post your $pid variable should contain the ID of the post, which you can use calling update_field()


0

You've got your action/filter names slightly off: // For registering the column add_filter( 'manage_posts_columns', 'custom_posts_table_head' ); // For rendering the column add_action( 'manage_posts_custom_column', 'custom_posts_table_content', 10, 2 );


0

As with many things, there is more than one way to accomplish this. A simple method is to pass an order and orderby value to the query. I believe the most efficient way to do this sort on a specific page is with pre_get_posts but rather than over-complicate this for you, the simple method instead. You'll create an "arguments" variable and pass these to a ...


0

Turns out there is currently a conflict between Advanced Custom Fields Pro (5.2.8) and Relevanssi Premium (1.13.3) plugins. If you enable the 'Use search in admin' function in Relevanssi then the problem described above appears. ACF support put the 'blame' in the Relevanssi plugin. I'm awaiting a reply from the developer if there is a work-around or ...


0

The code of raison's answer didn't worked for me... My code to get taxonomy name and term id in automatic way is like that: $taxonomy = get_taxonomy( $taxonomy ); $taxonomy_name = $taxonomy->name; $term_id = get_queried_object()->term_id; $image_ids = get_field('your acf field name here', $taxonomy_name . '_' . $term_id , false or true or empty or ...


0

Ok, I finally read many articles and finally I got everything right. So here is the solution now for other people if they get caught up in same situation. <article id="" class="page type-page status-publish hentry"> <header class="entry-header"> <h1 class="entry-title">Check Application Status</h1> ...



Top 50 recent answers are included