Retrieve a custom form field modified by a filter

I figured out how to proceed. I created a text file with the desired select options and just replaced the input field from the template with the bellow code. <?php $file_path=”FILE_PATH_HERE”; // path to the file with select options if ( !file_exists( $file_path ) ) { echo ‘<input type=”text” name=”location” placeholder=”‘ . __(“Location …”, “custom-settings”) … Read more

custom COOKIE on custom page

If all you are doing is setting a cookie on a page then why the complexity? Check this out for a simple answer http://www.w3schools.com/php/func_http_setcookie.asp My only thought is that you are then trying to redirect them back to WordPress and if so you may wish to check this Setting custom cookies in WordPress I’d say … Read more

How to run a function when publish posts? [duplicate]

Unless you have a very specific reason, and you know what you are doing, code like this belongs in the functions.php file or a dedicated plugin. WordPress uses two kinds of hooks to allow certain functions to be triggered at specific times. These are called Actions and Filters. https://codex.wordpress.org/Plugin_API Placing code in a file that … Read more

Insert menu into theme location depending on user logged in/out status

Okay, figured it out! I’ve amended my theme function as follows: add_filter( ‘wp_nav_menu_items’, ‘add_loginout_link’, 10, 2 ); function add_loginout_link( $items, $args ) { if (is_user_logged_in() && $args->theme_location == ‘top_navigation’) { $items .= wp_nav_menu( array(‘menu’ => ‘menu-logged-in’, ‘container’ => ”, ‘echo’ => false, ‘items_wrap’ => ‘%3$s’) ); } elseif (!is_user_logged_in() && $args->theme_location == ‘top_navigation’) { $items … Read more