INCOMING: Wall of code for form and $_POST, not updating custom field’s value

Turns out the second form needs its own nonce and updated the code in the header of the page to do something if only the second form is submitted. See new code: <?php $lucs_stored_meta = get_post_meta($post->ID); // salt shaker, drawing straws, randomness function lucs_random_thumbnail() { $lucs_random_image = rand(0,1); if ($lucs_random_image == 0) { $lucs_thumb_ra = … Read more

PHP calling function within a class

You can merge this two json objects via array_merge. But you must decode before to a array. You have this inside your example, below as single source function. This should get the merged json object. A example function, usable for your mix_cat()method. function mergeToJSON( $obj1, $obj2 ) { $json1 = $this->test_cat(); $json2 = $this->test_cat1(); if … Read more

Search bar for page that searches only particular page IDs

You can try to modify your filter like this function pregetposts_forspecificpage($query){ if(!is_admin() && $query->is_main_query() && is_search()) { $query->set(‘post_type’, ‘page’); $query->set(‘post__in’, array(22103,22121)); } } Edit : added !is_admin() because we only want to alter the query in the front. $query->is_main_query() to be sure that we are altering the main query. Replaced $query->is_search by is_search() Also, you … Read more

Showing the project type in HREF

It looks like the $project_type variable is not defined anywhere in the scope of your artwork page. You have to look into how to get the artwork’s project type on the artwork page. Is it a custom taxonomy? If yes, you would use functions like get_the_terms. I don’t know what the project type taxonomy is … Read more

Widget edit and add in any page

Search issue: You have label and br tags above search_keywords and search_location input fields. You can eater remove them in theme or set display: none; in css style for them. Css eg: .search_keywords label, .search_keywords br, .search_location label, .search_location br { display: none; } If you want to make map full width just like your … Read more

Are WordPress widgets cached?

Ok, seems that the problem is not related to the cache. But to the action execution order. If I update the value inside a page template (or inside a shortcode, that’s why I started my tests) the update fires after the render of the widget. Solution: update the value inside an action. In this example … Read more