If Statement is Ignored?
UPDATE: Turns out I was trying to make a comparison between a DateTime object and the date() function of PHP. When I switched date() to DateTime the comparison was fine.
UPDATE: Turns out I was trying to make a comparison between a DateTime object and the date() function of PHP. When I switched date() to DateTime the comparison was fine.
If you are using ACF then you don’t need to update field manually. Field will be updated when you update the post. And To retrieve this field use : get_field( ‘video_author’, $post_id ); For User field, make sure you have selected Field Type -> User in ACF.
Custom Post Type is always a preferable approach. To display all the projects in custom page template you need to learn few concepts for WP. 1.custom page template (To display your custom content) 2. WP_Query ( Fetch custom post type data with lot of advance query). For your reference please find the below documentation. https://developer.wordpress.org/reference/classes/wp_query/ … Read more
Once you get the id of the user in members variable. You then have to use get_post_meta to get the custom data of members because ACF uses meta boxes. After that merge the data with the members variable and then pass the variable to WP_REST_Response class. I would have commented but that reputation, so posted … Read more
The meta is within the taxonomy (so I have the standard, category name, slug, description etc and then I added a collectable tickbox to the category itself not the post/product) I solved this by Running a query for all sub categories and then I put an if statement in so it shows only categories with … Read more
I have not personally verified this but I had these two commands saved using WP-CLI which uses some clever regular expressions when I run into this scenario.
The style-attribute is not in the span-tag, but should be. Further you are using the php opening tag inside of the echo tag (copy-paste?). change ‘<span class=”termek-oldal-kategoria-teszt”> style=”background-color:<?php the_field(‘kollekcio_szine’); ?>”‘ to ‘<span class=”termek-oldal-kategoria-teszt” style=”background-color:’.get_field(‘kollekcio_szine’) . ‘”>’ (sorry, I would have commented, but I don’t have enough reputation)
Is it okay to use an ACF field to store a password for a protected area of a page?
To retrieve the Menu Name: $menu_name = wp_get_nav_menu_name(“menu-products”); Then, using the menu name you can get data like the nav menu: $term = get_term_by(‘name’, $menu_name, ‘nav_menu’); And using the term taxonomy ID you can pull the ACF fields $menu_id = $term->term_taxonomy_id; $post_id = ‘term_’.$menu_id; $field = get_field(‘my_acf_field’, $post_id); To retrieve list of menu Items: $menu … Read more
You have to use a regex, in this case, to extract the needed value from a string: $string = ‘Energizer AA Rechargeable Batteries 2300 mAh NiMH’; preg_match(‘/([0-9]+\s*mah)/i’, $string, $capacity ); if ( isset( $capacity[0] ) ) { printf(‘Battery: %s’, $capacity[0] ); } This regex /([0-9]+\s*mah)/i will look for any numbers followed by case insensitive mah … Read more