install Segment on WordPress

add that code to a js in your theme folder (or child theme if you’re using it). for this example I named the script “analytics.js” and put it in a directory called “js” in my child theme folder. Now register and enqueue the file by placing this code in your functions.php function wpse_load_script() { // … Read more

Display Custom Text if date_picker date is expired

If you’ve dropped it right into functions.php and not inside an action hook, the code is running before ACF has initialized. Try running on acf/init action (untested): add_action( ‘acf/init’, static function () { $currentdate = new DateTime(); $date = get_field( ‘date_picker’, false, false ); $date = new DateTime( $date ); if ( $currentdate > $date … Read more

How to set up a private custom post type that is accessible in the administrative dashboard?

For the frontend, you can use template_redirect action to identify the page, and perform redirects or adjust the request on the fly (untested): add_action( ‘template_redirect’, static function () { if ( ! is_singular( ‘cpt’ ) && ! is_post_type_archive( ‘cpt’ ) ) { return; } if ( current_user_can( ‘read_private_pages’ ) || current_user_can( ‘read_private_posts’ ) ) { … Read more

Trouble with WordPress Settings API: Form Submits When Fields Called Directly, Fails When Using Callbacks

Thank you for the responses Tom! You got me on track, I should have checked the rendered html earlier. Here’s the answer. The rendered html was showing hidden inputs, for clarity, I’ll just repeat my previous form with the hidden inputs that were being rendered: <form method=”post” action=”<?php echo admin_url(‘admin-post.php’); ?>”> <label>This form wont work</label> … Read more

Display box in sidebar of custom post type

It’s really easy, it’s called meta box and you can create one with the following code. /** * Register meta box(es). */ function plugin_prefix_register_meta_boxes() { add_meta_box( ‘meta-box-id’, __( ‘My Meta Box’, ‘textdomain’ ), ‘plugin_prefix_my_display_callback’, ‘custom_post_type’ ); } add_action( ‘add_meta_boxes’, ‘plugin_prefix_register_meta_boxes’ ); /** * Meta box display callback. * * @param WP_Post $post Current post object. … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş