Scriptrunner (Doug Sparling)
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: help with displaying most recent post on static pageAwesome! You’re quite welcome.
Forum: Fixing WordPress
In reply to: Exclude Single Post View of Certain CategoriesOK, let’s try something different. Here’s the most basic code to only prevent your post from showing as is_single (similar to making all your posts for a particular category private).
So in my case, when I go to my blog page (or category page), then I see the post title. When I click on the link to go to the single post page, I get a 404 (if the post belongs to the excluded category) – ID 1 in my case, which is generally the Uncategorized category by default.
function exclude_single_post( $query ) { $excluded_category_ids = array(1); if ( $query->is_single() ) { $post_categories = wp_get_post_categories( $query->query_vars['p'] ); foreach ($excluded_category_ids as $category_id ) { if ( in_array( $category_id, $post_categories ) ) { $query->set( 'p', -$category_id ); break; } } } } add_action( 'pre_get_posts', 'exclude_single_post' );Forum: Fixing WordPress
In reply to: How to add a copyrightFor your entire site…you should be able to add copyright copy to your footer.php. You might look and see if any there are any plugins that’ll work for you.
Forum: Fixing WordPress
In reply to: Exclude Single Post View of Certain CategoriesWhat was happening before you disabled plugins? Was it just not working for the single post page?
Forum: Fixing WordPress
In reply to: Exclude Single Post View of Certain CategoriesAdd this as the first line of your function:
echo "<strong>exclude_category called</strong>";and see if it shows up at the top of your page. Want to make sure the function is actually getting called.
If you want to send it to your error log instead, use
error_log("exclude_category called");instead…
Forum: Fixing WordPress
In reply to: Exclude Single Post View of Certain CategoriesAnd have you disabled any plugins you may have tried?
Forum: Fixing WordPress
In reply to: Exclude Single Post View of Certain CategoriesOK, this works perfectly for me, so let’s try and find what’s different. What works (if anything) and what doesn’t? (I assume the single doesn’t) That is, are your specified posts hidden from category but still show on the single page?
Forum: Fixing WordPress
In reply to: Accessing wp-admin on a different port/urlThe only thing I can think of (in regards to your original question) would be to use the WordPress
wp_insert_post_datafilter hook and remove the port (using a regex) before saving the post to the database.Forum: Fixing WordPress
In reply to: Accessing wp-admin on a different port/urlYes, dynamic IPs will pretty much make that solution impossible. (or incredibly difficult at best)
I’ve not ever used a separate port for WordPress admin specifically, though it should be possible.
Forum: Fixing WordPress
In reply to: help with displaying most recent post on static pageOr if you’re “echo” adverse, you could do it like this: 🙂
<?php $query = new WP_Query( array ( 'orderby' => 'date', 'order' => 'DESC', 'showposts' => '1' ) ); if ( $query->have_posts() ) : ?> <?php $query->the_post(); ?> <li><?php the_title(); ?></li> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'scrappy' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-content --> <span class="media-posted-on"> <?php edit_post_link( __( 'Edit', 'scrappy' ), '<span class="media-edit-link">', '</span>' ); ?> </span> <?php endif; ?>Forum: Fixing WordPress
In reply to: help with displaying most recent post on static page<?php $query = new WP_Query( array ( 'orderby' => 'date', 'order' => 'DESC', 'showposts' => '1' ) ); if ( $query->have_posts() ) { $query->the_post(); echo '<li>' . get_the_title() . '</li>'; echo '<div class="entry-content">'; the_content(); wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'scrappy' ), 'after' => '</div>' ) ); echo '</div><!-- .entry-content -->'; echo '<span class="media-posted-on">'; edit_post_link( __( 'Edit', 'scrappy' ), '<span class="media-edit-link">', '</span>' ); echo '</span>'; } ?>Since you’re only wanting one post, I changed
whiletoif, the the end result is the same.Forum: Fixing WordPress
In reply to: Accessing wp-admin on a different port/urlOr even simpler:
<FilesMatch wp-login.php> Order Deny, Allow Allow from xxx.xxx.xxx.xxx Deny from all </FilesMatch>Forum: Fixing WordPress
In reply to: Accessing wp-admin on a different port/urlI’d do one of two things.
1) Add Apache basic-authentication in front of wp-login.php (via wp-admin/.htaccess).
2) Only allow access to wp-login.php and admin to an internal IP:
Root-level .htaccess:
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR] RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$ RewriteRule ^(.*)$ - [R=403,L] </IfModule>Updating this line:
RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$with your actual IP address.
Forum: Fixing WordPress
In reply to: Sharing ad revenue with authorsIf ad rev share is an important part of your business (or even if not), I’d got with WPMU DEV. Besides being familiar with the company, the plugin appears to have a substantial amount of downloads and a good rating.
But looking on the WPMU DEV forums, I see this comment:
Q: The Ad Sharing plugin looks perfect for sharing revenue across authors, but I only need it for a single wordpress install, not multisite. Is there a plugin like that?
Essentially I’d like to have all my authors get a percentage of the income from ads on the blog.
A: Unfortunately not. the ad sharing is designed for multiple sites users, not sharing with users on a single site.
They go on to suggest trying a plugin you already mentioned (note, the comment was from early this year):
Revenue Share for Authors (RSP for WordPress)
So I’d check with WPMU if the plugin is truly for multisite only (if you’re not running multisite).
Forum: Fixing WordPress
In reply to: Brute Force Attackers Know My Registrants' UsernamesI’ve not heard of that, though thinking of how this could happen a couple things come to mind. Can your registered users posts and are their names listed as author along with the posts if the can (this wouldn’t be the username, but a user’s screen name might be guessed from that). I’d think if someone was sniffing open traffic (non-SSL), they’d get the password too. Or since passwords are encrypted in the database, maybe usernames were obtained somehow.
That all said, I’d just harden the site down even more and add additional security specifically for brute force attacks in general. I always use one of the many login lockdown plugins, or more lately, I just use that feature in Better WP Security.