How do you display a custom field on a new page? [closed]
<?php if (get_field (‘sponser_advertisement’)) { echo ‘this is my field: ‘. get_field (‘sponser_advertisement’); } ?> (however you spelled sponsor wrong…) 🙂
<?php if (get_field (‘sponser_advertisement’)) { echo ‘this is my field: ‘. get_field (‘sponser_advertisement’); } ?> (however you spelled sponsor wrong…) 🙂
That is because get_terms() does not accept array type as a value for the ‘orderby’ parameter. The documentation says about this parameter: ‘orderby’ (string) Field(s) to order terms by. Accepts term fields (‘name’, ‘slug’, ‘term_group’, ‘term_id’, ‘id’, ‘description’), ‘count’ for term taxonomy count, ‘include’ to match the ‘order’ of the $include param, ‘meta_value’, ‘meta_value_num’, the … Read more
You have 2 options: use a Options Page (if you have ACF Pro) or you can also get the values from another post. Options Page First you create a settings page on your functions.php: if( function_exists(‘acf_add_options_page’) ) { acf_add_options_page(); } Then on ACF you select that those fields belong to an options page and you … Read more
Plugins typically insert their content via the_content filter. The filter runs when the_content() function is called, and passes the content through the filter before output. Remember, with a filter, you need to append to the existing content, then return the results. add_filter( ‘the_content’, ‘wpd_content_filter’, 10 ); function wpd_content_filter( $content ){ if ( is_single() && get_field( … Read more
You could just use: echo get_field(‘consultant_name’)[‘ID’];
I’ve had a fair share of issues with ACF, but end up using it still. There could be 3 things causing your problem. you could try changing your php settings: max_input_time = 42000 max_execution_time = 42000 max_input_vars = 50000 This next one is not a great fix as if WordPress ever decides to update their … Read more
You could make one php file (not a page template) for the code of that group. Then you can include that file on the pages so you only have to edit one file to indirectly edit all the files that included that file. You can do this with the get_template_part function For example: You create … Read more
An even easier option is to use my Gravity Forms Media Library plugin. Here’s the meat and potatoes of the functionality: public function maybe_upload_to_media_library( $entry, $form ) { $has_change = false; foreach( $form[‘fields’] as $field ) { if( ! $this->is_applicable_field( $field ) ) { continue; } $value = $entry[ $field->id ]; if( $field->multipleFiles ) { … Read more
To be compatible with ACF you should first find out how ACF is saving checkboxes values to database. As I now this is serialized array. When we know that we must save our frontend checkboxes in the same way. The good news is you can pass only array to update_post_meta and WordPress will take care … Read more
You cannot write PHP code in the WordPress post editor screen. You can do this by editing the theme’s template files (using an FTP client). This means you need to write the entire structure of the page using HTML/PHP. You could look into making a shortcode. A shortcode enables you to execute a predefined piece … Read more