xsonic
  • Member for 9 years, 6 months
  • Last seen this week
Way to check if we are in Theme Customizer mode?
Accepted answer
7 votes

As in this question: How to execute conditional script when on new customize.php (Theme Customize) screen global $wp_customize; if ( isset( $wp_customize ) ) { // do stuff }

View answer
Add option to "Gallery Settings" section
Accepted answer
5 votes

Thanks to the hint with the multiple galleries plugin from Niall Campbell and thanks to this question How to Add a Custom Colum on Thickbox Media Gallery Tab? (where I got the hook admin_head-media-...

View answer
Embedded Twitter feed won't render nicely when loaded via Ajax
Accepted answer
4 votes

ok, got it. Need to embed <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script> manually And then fire twttr.widgets.load(); after appending the posts. Thx anyways,...

View answer
Extracting Address from Custom Post via Javascript for Google Maps API
Accepted answer
3 votes

Well, this is kind of easy.. The google-map API needs a format like Your Street 123, 54321 Your City Assuming you have your data like this: <div id="street">Your Street 123</div> <...

View answer
url - ajax loaded but no JS
Accepted answer
3 votes

Try this code in your complete callback of the load function: $(".postbox_wrapper").load( jQuery(this).attr("href") + " .postbox_wrapper", function(response, status, xhr) { // complete ...

View answer
Shortcodes Keep Wrapping in <p></p>
Accepted answer
2 votes

Try https://wordpress.org/plugins/shortcode-empty-paragraph-fix/ It basically removes any p-tags before and after [ or ], before rendering the content. So the output of your shortcodes won't be ...

View answer
How to do paging in the loop?
2 votes

Try adding 'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1, // this will get the right posts for the current page (i.e. if the user loads www.domain.com/blog/page/2 directly) '...

View answer
One information repeated on multiple locations on one site
1 votes

There are many ways to achieve this. You can use a widget and custom widgetareas or print it with a plugin like widget on pages. You can create a page and print the pages content like this. (you can ...

View answer
Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
1 votes

In general, this function lets you localize your JS strings, but you can also use it to set global JS variables: function set_my_js_var() { // logic here for returning the right JS var $myVar ...

View answer
multiple queries to get posts from same category?
1 votes

Just add a counter to the loop. Just use $wp_query->current_post while ( have_posts() ) : the_post(); if($wp_query->current_post <= 1) // 1 because counter starts at 0 // <...

View answer
How to add a sub menu with AJAX?
1 votes

As you can't suppose to get a full working example without any given code, I'll show you a rough wordpress AJAX setup: Put all this in functions.php: <?php add_action('wp_head', '...

View answer
Setting thumbnail featured image size not working properly
Accepted answer
1 votes

It's default behaviour that the images aren't scaled up. Easiest way would be to use simple CSS to scale it up. How to scale up featured post thumbnail? For the second part set the crop parameter of ...

View answer
Getting selection of posts based on loop variables via Ajax
1 votes

You can easily add whatever variables you want to your AJAX call. Using jQuery you can set a AJAX action like this: jQuery.post( 'your-url-to-admin-ajax.php', { action: '...

View answer
Revise my keyword but still cannot login
Accepted answer
0 votes

You somehow changed user_login to your password hash. user_login should be luofeiyu

View answer
Small intro before latest blog posts
0 votes

Two methods: Edit the template file: Find the template file that renders your posts (most likely index.php) and find the place where the post loop starts. Something like: <?php if (have_posts())...

View answer
wp_update_post via ajax from frontend
Accepted answer
0 votes

Problem was Textarea autocompleting in Firefox (this problem was only present in FF, as I noticed) For now, I have added autocomplete="off" to the textarea created in class-wp-editor.php Adding it ...

View answer
How do I use Ajax to show the new posts realtime, on the frontpage
0 votes

In my (limited) programming world, I found Ajax long polling to be the easiest way of doing live updates. Here is a basic example of it: https://stackoverflow.com/questions/333664/simple-long-polling-...

View answer
Missing the first 6 Posts and displaying posts that are after the latest 6
0 votes

I'd run two seperate queries, the first with 'showposts' => 6 and the second one with the offset parameter. http://codex.wordpress.org/Template_Tags/get_posts#Posts_list_with_offset simply add '...

View answer
How to localized one js file for different actions?
Accepted answer
0 votes

Maybe I got your question wrong. I don't get what you mean by: If I don't do the localize, I can't get response. But in general, this function lets you localize your JS strings, but you can also ...

View answer