How do I get a list of popular posts by views?
Personaly i already used the wp-postviews plugin and it works fine. Comes with a widget to display the list in a sidebar.
Personaly i already used the wp-postviews plugin and it works fine. Comes with a widget to display the list in a sidebar.
You can integrate the wordpress authentication with the apache webserver and then configure which additional resources need a login on your webserver. This works with PHP as well with HTML and images. For more information, please see mod_auth_mysql and phpass.
While this question is several months old and you’ve probably figured something out already, I figured it was worth answering anyway. This is possible to do using the WP Multi Network Plugin. WordPress has the underlying structure to accomplish this, but no accompanying UI — this plugin merely offers that interface. Some things are not … Read more
home_url() function is implemented in WordPress since version 3.0.0, and you are using version 2.8.5. To fix this error edit wp-content/themes/twentyten 3/header.php file – replace: home_url(); with: ‘http://’.$_SERVER[“SERVER_NAME”] This is hotfix, and i’m afraid you will receive more errors like this. “Responsive Twenty Ten’ are compatible with 2.8+” – as you see it’s not true … Read more
You need to register the query var so it doesn’t get stripped by WP. Add this to your functions.php file. function foo_add_query_var($vars) { $vars[] = ‘discount’; return $vars; } add_filter(‘query_vars’, ‘foo_add_query_var’); To call this in your template, simply use the following: $discount = get_query_var(‘discount’);
Yes, WordPress uses output buffering for displaying these messages. There’s a nifty function you can use within your loop called show_message() which utilizes wp_ob_end_flush_all(); function show_message($message) { if ( is_wp_error($message) ){ if ( $message->get_error_data() ) $message = $message->get_error_message() . ‘: ‘ . $message->get_error_data(); else $message = $message->get_error_message(); } echo “<p>$message</p>\n”; wp_ob_end_flush_all(); flush(); } You might … Read more
That will not work because you are referring to a single php file, instead the the whole WordPress environment. There’s a easier way to use ajax in WordPress. Use admin_url(‘admin-ajax’) as the form action, then put the function that will answer the ajax call in the theme’s functions.php. More detail here in this answer
Don’t wrap the entire section in __(), just wrap the part you need to translate: <?php next_post_link( ‘%link’, ‘<span class=”meta-nav”>←</span> ‘ . __( ‘Nästa nyhet’, ‘mytheme’ ) ); ?>
Use json_encode(): <li class=”griditemleft” data-tags=”<?php $posttags = get_the_tags(); $data = array(); foreach($posttags as $tag) { $data[] = $tag->name; } echo json_encode( $data ); Later, in your JavaScript, iterate over the li items and for each item use: // get an array of tag names with jQuery’s parseJSON() var itemtags = $.parseJSON( item.data(‘tags’) ); See jQuery … Read more
Turns out I’m just silly. WP_Error was the undefined method, not resize. I was sending a bad image location through the resize function. How silly of me! It was working all along. I’ve included this on top $parse_uri = explode( ‘wp-content’, $_SERVER[‘SCRIPT_FILENAME’] ); require_once( $parse_uri[0] . ‘wp-load.php’ ); and this is my image resize function … Read more