user1049961
  • Member for 7 years, 11 months
  • Last seen this week
Custom URL for each product variation - rewrite rules
Accepted answer
4 votes

Ok, for anyone looking for this, here's a complete plugin that I came up with, that solves the issue: <?php /* Plugin Name: WooCommerce Variations URL Description: Adds support for variation-...

View answer
How to use wp_localize_script in a WordPress page other than functions.php?
2 votes

You cannot use wp_localize_script in page template. You have to use it in functions.php or your custom plugin, after you register your script, which is usually in the wp_enqueue_scripts action. https:...

View answer
How to create more than one new wpdb object?
1 votes

The $new_db_connection is your new db object. Just use that to access the other db, ie. $new_db_connection->get_row("your query");

View answer
Modifying post titles on pages, archives and single but not dashboard/admin
Accepted answer
1 votes

Move the return $title; one line lower. You are not returning anything for administration.

View answer
Comment Approve - Add custom function when comment is approved
1 votes

Sadly there are no hooks or filters that you could use in edit-comments.php. You'd have to build your own admin page with a custom button and use wp_set_comment_status( $comment, 'approve' ); to ...

View answer
Add Adsense code between job listings - wp job manager plugin
1 votes

There's a filter for the output $job_listings_output = apply_filters( 'job_manager_job_listings_output', ob_get_clean() ); so, you should just do add_filter('job_manager_job_listings_output','...

View answer
Easy way to process search results before displaying
1 votes

You can use pre_get_posts filter to filter out what you need. There's an example on how to do this in Codex: https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#...

View answer
Buddypress - adding custom post to members
1 votes

There are more problems: 1) Add the activity on adding meeting You could use the save_post hook to add activity, but I'd rather add custom notification, as the activity item can be easily missed. ...

View answer
Update post meta - Custom field does not match meta-key
Accepted answer
1 votes

Arrays are serialized by default, so just do update_post_meta($my_post, 'ganalytics_settings', $ganalytics_settings); https://codex.wordpress.org/Function_Reference/update_post_meta $meta_value (...

View answer
How to get all pages on specific blog after switch_to_blog?
0 votes

Try using get_posts instead of get_pages $pages = get_posts( array( 'order' => 'ASC', 'orderby' => 'ID', 'post_type' => 'page', 'post_status' => 'publish', ...

View answer
date_query won't accept day parameter, but will accept month and year for a custom post
0 votes

As said in comments, you should use meta_query. For help on how to query posts by ACF meta field, you can check the ACF documentation: https://www.advancedcustomfields.com/resources/query-posts-...

View answer
Updating meta_value in a custom key
Accepted answer
0 votes

The problem is this line $sales = get_user_meta($_POST['repID'], 'sales'); change it to $sales = get_user_meta($_POST['repID'], 'sales', true); The last parameter says, that you are getting a ...

View answer
Localization of menu items
0 votes

Get a WPML plugin - https://wpml.org/ Seriously, get it - it's the most complete solution for multilingual WP site. You can write your own code to translate menu items, but it is not worth it.

View answer
How do I change my Wordpress website's address or URL?
0 votes

While changing the Site URL under Settings -> General will change the website URL, it will also break the site. You should download the Search and replace tool, copy it on your webserver, run it and ...

View answer
How can I pull the slug of a custom taxonomy and output it in a class?
0 votes

You can easily just get the taxonomies you need with wp_get_object_terms, and than do something like $class =''; foreach ($genres as $genre) { $class .= $genre->slug; } Do this for each of ...

View answer
SQL - JOIN last child
0 votes

This is the solution I came up with: SELECT child_ID, posts.post_author, wp1.post_author FROM wp_posts posts LEFT JOIN ( SELECT MAX(ID) as child_ID, post_parent FROM wp_posts WHERE ...

View answer
Using wp config to connect to a DB from a plugin
-1 votes

You are probably just missing the slash in the require_once. Change it to: require_once(ABSPATH . '/wp-settings.php');

View answer
How do you translate comments_number function text in a theme?
-1 votes

The comments_number function is calling get_comments_number_text function: https://developer.wordpress.org/reference/functions/get_comments_number_text/ In that function there are your strings to ...

View answer
Make a permalink to the most recent blog post
-2 votes

Use get_posts with posts_per_page => 1 to get only one latest result. You can than use get_permalink() to get the permalink. $args = array( 'posts_per_page' => 1, 'orderby' =&...

View answer