Adding dynamic section to WordPress

There are a few approaches to this that could work. If you look around here for questions regarding “virtual pages” you might find some options that could work for you. One quick way to implement this- 1) Create a page under Pages in WordPress admin. This will be the page that’s loaded in the main … Read more

Custom url structure for custom template

In the link you attached, you have everything you need. You should: add query variable (e.g operators_actv), add rewrite rule that sets this variable (operators_actv), use the template_include action hook to load custom template if query variable operators_actv is set. Code: add_filter( ‘query_vars’, ‘se332319_custom_query_vars’ ); add_filter( ‘template_include’, ‘se332319_custom_template’, 50 ); add_action( ‘generate_rewrite_rules’, ‘se332319_resources_cpt_generating_rule’ ); function … Read more

How does WooCommerce display a custom comment_type in Comment Admin?

To answer your first question: »How does WooCommerce add the comment_type of order_note to the dropdown in Comment Administration?«. From woocommerce-admin-init.php: function woocommerce_admin_comment_types_dropdown( $types ) { $types[‘order_note’] = __( ‘Order notes’, ‘woocommerce’ ); return $types; } add_filter( ‘admin_comment_types_dropdown’, ‘woocommerce_admin_comment_types_dropdown’ ); Of course you have to do your own, to avoid conflicts, like this: add_filter( ‘admin_comment_types_dropdown’, … Read more

Uploaded image not appearing in custom post type

How About you try this code for your attachment $uploaded_file = wp_handle_upload( $file, $upload_overrides ); $attachment = array( ‘post_mime_type’ => $uploaded_file[‘type’], ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, basename( $uploaded_file[‘file’] ) ), ‘post_content’ => ”, ‘post_author’ => ”, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_parent’ => $new_reseller_id, ‘guid’ => $uploaded_file[‘file’] ); $attachment_id = wp_insert_attachment( $attachment, $uploaded_file[‘file’] ); $attach_data … Read more