Categories
CMS Mastering Development Wordpress

How to trigger a function when submit a form

How can I make work these functions not just when the user profile is updated. Also when a frontend form is submited? Here the functions: function get_channel_by_author( $user_id ) : int { // if we don’t find anything then a value of 0 will create a new post rather than update an existing post. $channel_id […]

Categories
CMS Mastering Development Wordpress

retrieve thumbnail from post ID of best selling product within product_tag taxonomy

I have used the below code to retrieve the thumbnail of best selling product within a product category and thought I could do the same for product tags by simply switching out the taxonomy to product_tag, however it has not worked. $terms = get_terms( ‘product_cat’, array( ‘hide_empty’ => false, ) ); foreach ( $terms as […]

Categories
CMS Mastering Development Wordpress

Check post exists by post_name not post_title

Is it possible to check if a posts exists using the post_name (not the post_title)? I’m aware of post_exists() but that uses the title not the name. I’m also aware of doing the following but this doesn’t work IF the post is a draft and the user is not logged in. $posts = get_posts( array( […]

Categories
CMS Mastering Development Wordpress

Woocommerce add and show star ratings

I want to show the rating stars on 2 places on my woocommerce website: In the custom product loop And the single product page I’ve added do_action(‘woocommerce_template_loop_rating’); in the product loop and added do_action(‘woocommerce_template_single_rating’); and the single-product.php page. But nothing happens. I’ve selected these 2 options in the Woocommerce settings: Enable star rating on reviews […]

Categories
CMS Mastering Development Wordpress

popular post, I would like to add one more filter

I’m using the popular posts plugin popular post, and the secondary title plugin added a secondary_title filter. Secondary title is right, I would like to add the artist. Thank you. function wpp_parse_tags_in_popular_posts($html, $post_id){ // Replace custom content tag {secondary_title} // with the actual secondary title if ( false !== strpos($html, ‘{secondary_title}’) && function_exists(‘has_secondary_title’) ) { […]

Categories
CMS Mastering Development Wordpress

Most commented post showing 2 records

I am trying to show the most commented post. Only one post should show but I am getting 2 even though the number of comments is not the same? <?php $args = array( ‘orderby’ => ‘comment_count’, ‘posts_per_page’ => 1, ); $most_commented = new WP_Query($args); ?> <?php if ($most_commented->have_posts() ): while ($most_commented->have_posts() ): $most_commented->the_post(); $author_id = […]

Categories
CMS Mastering Development Wordpress

Order posts alphabetically with numbers but some of the posts has numbers in the title

I have this query: $args = array( ‘post_type’ => ‘alerts’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘orderby’ => ‘post_title’, ‘order’ => ‘ASC’, ); $alerts_loop = new WP_Query( $args ); The problem is that the order breaks in certain point. look at the imagen any ideas why it breaks. I have used: ‘orderby’ => ‘title’, ‘suppress_filters’ […]

Categories
CMS Mastering Development Wordpress

Order posts alphabetically with numbers but some of the posts has numbers in the title

I have this query: $args = array( ‘post_type’ => ‘alerts’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘orderby’ => ‘post_title’, ‘order’ => ‘ASC’, ); $alerts_loop = new WP_Query( $args ); The problem is that the order breaks in certain point. look at the imagen any ideas why it breaks. I have used: ‘orderby’ => ‘title’, ‘suppress_filters’ […]

Categories
CMS Mastering Development Wordpress

Order posts alphabetically with numbers but some of the posts has numbers in the title

I have this query: $args = array( ‘post_type’ => ‘alerts’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘orderby’ => ‘post_title’, ‘order’ => ‘ASC’, ); $alerts_loop = new WP_Query( $args ); The problem is that the order breaks in certain point. look at the imagen any ideas why it breaks. I have used: ‘orderby’ => ‘title’, ‘suppress_filters’ […]

Categories
CMS Mastering Development Wordpress

Prev/Next Navigation on Single Post Disappeared for Custom Post Type

Hope it’s okay to ask this question here – I’m not really a developer. I’ve been using Dox theme for a friend’s website, and we are ready to go live over the weekend and the Theme developer isn’t getting back very fast. I’ve done some CSS customisations on the website, not a huge amount of […]