Add class to all parent elements inside the_content
Add class to all parent elements inside the_content
Umm. Normally, people ask questions here that are more than yes/no questions, but hey, I’m game. Yes, that code looks fine to me. Hope that helps! 🙂 Also note that there is a built in function called __return_true which is there for usage just like so: add_filter( ‘image_priority’, ‘__return_true’ ); Easy. Also also note that … Read more
Try dumping your data and you should see the problem: function coinDeposit() { $current_user = wp_get_current_user(); var_dump($current_user); die; update_user_meta( $ID, ‘depositAddress’, $account); } The user object is empty. That is because a newly created user is not automatically logged in. There is an email confirmation step, and then login. Until that login, wp_current_user() isn’t going … Read more
Add class to all parent elements inside the_content
Have you tried using the ‘the_content’ filter? Something like this should probably do the Job , note that i have not had the time to test this . function my_prettyadd($content) { global $post; $pattern = “/(<a(?![^>]*?rel=[‘\”]prettyPhoto.*)[^>]*?href=[‘\”][^’\”]+?\.(?:bmp|gif|jpg|jpeg|png)[‘\”][^\>]*)>/i”; $replacement=”$1 rel=”prettyPhoto[“.$post->ID.’]”>’; $content = preg_replace($pattern, $replacement, $content); return $content; } add_filter(“the_content”,”my_prettyadd”); simple regex that will add a rel to … Read more
My recommendation is to register a custom post type. You can call it products, and then all posts placed under Products will get the http://domain.com/products/some-product rewrite. Once it’s its own post type, you can specify a custom template for it, single-product.php, and you can add any custom fields, classes, etc. from there.
Shortcodes and Tags At first, please keep in mind that your understanding of tags is actually a shortcode. A Tag is used to add meta information to content, while a shortcode is used for adding functionality, usually to be called from inside the content. To your Problem As @s_ha_dum pointed out, you should implement your … Read more
I ran a test and the following works: global $testMe; $testMe = 0; function my_acf_update_value( $value, $post_id, $field ) { global $testMe; $testMe = $value; return $value; } add_filter(‘acf/update_value/key=field_5308e5e79784b’, ‘my_acf_update_value’, 10, 3); // Test: Apply the filter apply_filters(‘acf/update_value/key=field_5308e5e79784b’,’a’,’b’,’c’); // end Test echo $testMe; // prints ‘a’ So, in principle, your code is functional. There are … Read more
There is a way to apply that to all post content. function sc_all_content_wpse_137734($posts) { foreach ($posts as &$p) { $p->post_content = do_shortcode($p->post_content); } return $posts; } add_filter(‘the_posts’,’sc_all_content_wpse_137734′); I would suggest that this is a very, very good way to break things. Plugins and themes will not expect shortcodes to be rendered that early, and the … Read more
I have created new colums in a SQL table ‘wp_users’. Those fields are “giodo”, “handel” and “regulamin”. Don’t add columns to Core tables. There is no guarantee that these won’t be destroyed or corrupted on next update. What you should be using is user meta, and in fact that appears to be what you are … Read more
It should be possible but you will have to be aware of timing issues. Your shortcode will have to execute before whatever hook you are hooking into. That is, you can’t hook into wp_enqueue_scripts or wp_head but you should be able to hook into later hooks like wp_footer. I suspect that timing is the problem.