Add custom column for custom field

I adjusted the code for you. You can directly use the code in functions.php file. Here is more reference that can help you to understand more. Link 1 Link 2 // Adding Custom Column add_filter(‘manage_stfic_posts_columns’, ‘ST4_columns_head_only_stfic’, 10); add_action(‘manage_stfic_posts_custom_column’, ‘ST4_columns_content_only_stfic’, 10, 2); // CREATE TWO FUNCTIONS TO HANDLE THE COLUMN function ST4_columns_head_only_stfic($defaults) { $defaults[‘bookcode’] = ‘Book … Read more

Modify date query by URL parameter using pre_get_posts and $_GET

I’m not where I can test this, but for something like: www.website.com/events?date=past, perhaps an approach like that outlined below could work. (I can almost guarantee a type or two, so be sure to rewrite/edit/rework this into your function and ensure you don’t inherit my errors). if (isset($_GET[‘date’])) { //using past, present, future as example. not … Read more

Front-End User Profile

UPDATE: As mentioned in the comments, you might want to learn how you do things like create meta boxes and do a file upload in WordPress without using a framework like CMB2 first. However, as a seasoned WordPress developer, I have found that using CMB2 greatly increased my productivity. I highly recommend using CMB2 to … Read more

Front end register with custom fields

With the help of something @TurtleTread said, I managed to get it working. My code was fine except had to change two things. I removed the custom field from my $user_data, and added this after right after wp_insert_user — add_user_meta($user_id, ‘broker_email’, $b_email); Here’s my final code in my functions.php file — add_action(‘template_redirect’, ‘register_a_user’); function register_a_user(){ … Read more

Best way to contruct a global custom field?

I would use an option page which would show up in the settings. I used Example #2 from here for a few of my projects. Then you would use it in your theme like this: $o = get_option(‘my_option_name’); // how you named the options from Example #2 $field = $o[‘field_name’]; // how you named the … Read more

Pass PHP through redirect and custom fields

Without touching rewrites – you could probably do somthing like website.com/?goto-amazon=<?php echo get_the_ID() ?> Which’ed output website.com/?goto-amazon=42 Where 42 is an example of a post that contains the amazon_keywords. In your site you could listen for the goto-amazon query and redirect thereafter add_action( ‘init’, function(){ if (isset($_GET[‘goto-amazon’])) { $keywds = get_field(‘amazon_keywords’,intval($_GET[‘goto-amazon’])); $link = “http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords={$keywds}&linkCode=ur2&tag=AFFID”; wp_redirect($link); … Read more