display widget checkbox selection on frontend

Without actually knowing what you’re trying to achieve I see the following problems: $post variable is not defined in your widget() method. Try setting it using $post = get_post( get_the_ID() ) for instance. By the time you call foreach ($posts as $post) { … } $posts variable is also not set. You need some query … Read more

Better approach for a WordPress Inventory

In general, categories are tied to posts only (not custom types). This is built-in taxonomy. Though there is another experience. My approach is to create custom post types and custom taxonomies. That’s up to you how to organize the catalog. CPT for company and taxonomy for product family, or otherwise: /makita/drills/product_1 /makita/drills/product_2 /bosch/drills/product_1 /bosch/drills/product_1 or … Read more

Add Link to Users List (Backend) to open each users front-end profile

The following will add a “View author profile” link to the row actions (i.e., the links that appear when you hover over the username): add_filter (‘user_row_actions’, ‘add_view_author_page’, 10, 2) ; function add_view_author_page ($actions, $user) { $href = esc_attr (get_author_posts_url ($user->ID)) ; $actions[‘add_view_author_page’] = “<a href=”https://wordpress.stackexchange.com/questions/259665/$href”>View author page</a>” ; return ($actions) ; } Edit: Or if … Read more

How to get post from pure frontend AJAX (using only post ID)?

You can output your javascript via wp_add_inline_script(). This way you can set the post”s id and AJAX URL before outputting the code: wp_add_inline_script(‘my-js’, ‘ jQuery.ajax({ \’url\’ : ‘.admin_url(‘admin-ajax.php?action=my_action’).’ data : { \’id\’ : ‘.get_the_ID().’ } });’); Note that you need to hook to an existing js file to be able to add inline script, so … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)