Articles of query string

Check if page is embeded

I’m trying to make condition that checks if the page is embeded with iFrame, but all the ways I know won’t work. I’m embeding Woocommerce single product page, on custom template where only necessary scripts and styles are loaded (template is loaded depending on string query). The problem is that, I want to change “add […]

How to get “string” away – replaced with “nothing”

I am having – an issue respectively I like to try something: with this code, I get the title from a product – respectively what is stored in the database, so far: woocommerce_template_single_title(); $shaka_title = ob_get_clean(); The output is followed: <H1 CLASS=”PRODUCT_TITLE ENTRY-TITLE”>FUN DIVING – 2 DIVE’S (AROUND KOH TAO)</H1> What I need is only […]

Can't add external rewrites

I’ve got the following code in my functions.php function add_custom_rewrite_rules(){ add_rewrite_tag(‘%gallery%’,'([^/]+)’, ‘gallery=’); add_rewrite_tag(‘%album%’,'([^/]+)’, ‘album=’); add_rewrite_rule(‘galleries/(.+)/?$’ , ‘index.php?pagename=galleries&album=1&gallery=$matches[1]’); } add_action(‘init’, ‘flush_rewrite_rules’); add_action(‘init’, ‘add_custom_rewrite_rules’); But the rewrite rule is not getting added, and it doesn’t show up in my list of rewrites in the admin.

How can I get the shortcode to allow query string parameters?

Using WordPress 4.4.2 (latest version as of writing this) I’m trying to use the shortcode to show a video on my site. If I provide a url ending with the filename.mp4 it works fine: but when I add a querystring parameter to the end of the URL, it refuses to show the video player. Instead, […]

Change gravity forms confirmation redirect query string to include entry id

I need to somehow insert the entry id from a Gravity Forms submission into a redirect confirmation. My problem is, that when attempting to create a confirmation via the admin interface, I can insert the entry id into a hidden field, but it doesn’t exist until after everything fires, rendering my query string blank (although […]

How do you Query posts with nothing in common?

We can get multiple posts manually in a page, but that’s generated in a template, AFTER the default query returned something else (page/post, etc) How do you query multiple posts in a public query, which share no taxonomy or anything else? e.g. by ID: http://example.com/?p=23,18,2,199,6,8 I got it working already parsing a variable in a […]

How to order results by date and meta key?

I’m using wp-postratings to rate posts which stores the rating as a custom meta value ratings_score. It gives you the option to use r_sortby to order the loop by highest rated but I want to give it a trending feel by dividing the $ratings_score” by how old the post is in days. So something like […]

Can't pass table to $wpdb->prepare

I’m having trouble passing a table variable to $wpdb->prepare(); Here is functioning code: $table = $wpdb->get_blog_prefix( $blog_id ) . ‘my_table’; $voters = $wpdb->get_row($wpdb->prepare(“SELECT * FROM $table WHERE user_id= %d AND post_id = %d;”, $user_ID, $post->ID )); This works great. However I think I should also be including my table in the prepare statement. But, it […]

How to remove query string from static resources

Any expert who knows about removing Remove Query Strings From Static Resources plugin? It’s not working. Also, I have tried to write this code in function.php file of my theme function _remove_script_version( $src ){ $parts = explode( ‘?’, $src ); return $parts[0]; } add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 ); add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 ); […]

query_vars Filter: Would You Ever Use It When $_GET is Available and You Don't Need a 'Pretty' URL?

I’m having a hard time wrapping my head around the uses cases/best practice for the ‘query_vars’ filter, and query_vars in general, when I could use the $_GET global instead. Given http://example.com/my-page/?mykey=myvalue: If I’m not altering the query, I understand that it wouldn’t be appropriate to add ‘mykey’ as a query var. But if I AM […]