Posted on Leave a comment

How to Enable WordPress Error Logging for Debugging

Bugs happen. When they do, error reporting is needed to squash them. Here is how to turn it on.

Look for these line and/or add them to your WordPress wp-config.php file. This file is located in your WordPress home directory.

// Turn on Debugging
define('WP_DEBUG', TRUE); 

// Yes, log errors please
define( 'WP_DEBUG_LOG', TRUE );

// Let's not show errors on the page.
define( 'WP_DEBUG_DISPLAY', FALSE ); 

Now, when things go bad for WordPress, you can see why by visiting this file:

http://[your-website]/wp-content/debug.log

Now go a step further and turn on PHP Error Reporting. Add this snippet next.

// Turn on Error Reporting
ini_set("log_errors", TRUE);

// Report ALL issues, not just the really bad ones.
error_reporting (E_ALL);

// Let's not show errors on the page.
ini_set ('display_errors', FALSE);

This creates error logs in the folder that they’ve happened in. For WordPress theme and plugin issues, we generally are interested in this file:

http://[your-website]/wp-content/error_log

It’s important to point out that once the bugs are squashed, you probably should turn error reporting off. To do this, simply change each TRUE to FALSE.

Posted on Leave a comment

Protect Login Page

This is a simple plugin that protects access to your WordPress website’s login page by intercepting the page request and requiring that a PIN number, up to 8 digits, be present in the URL. Without the proper PIN, no login form is displayed, just a simple message. This plugin will make it harder for hackers to get into your website.

Once activated, you will access your login page like this…

http://yourwebsite.com/wp-login.php?PIN=[your PIN goes here]

IMPORTANT – DO NOT use this plugin if you require login access other than the main WordPress login page, such as the WordPress mobile app.

Installation

To install, simply upload the plugin zip file to your WordPress website and activate it. Configure the simple settings in the new menu that will appear in your Settings menu. Explanations of each feature accompany the inputs.

Frequently Asked Questions

Q: How do I log in once the PIN is set?

A: To log in, just add the PIN value to your WordPress login page URL, like so: http://mysite.com/wp-login.php?PIN=1234

Q: Do I have to add this PIN to the URL each time?

A: Yes, but if you set yourself a bookmark your life will be much easier.

Q: Why did you develop this plugin. Isn’t the login protection itself good enough.

A: Maybe, but I got tired of seeing all of the malicious login attempts in my server logs. I decided to come up with a way to stop this.

Q: What happens if I lose my PIN?

A: If you lose your PIN you will not be able to log into your website. Deactivate the plugin in the database (wp_options.eePLP_STATE = ‘OFF’) or rename the plugin’s folder in your files. You may also contact me for a rescue PIN.

DOWNLOAD HERE

Posted on Leave a comment

Can 2 WordPress Websites Share 1 WP-Content Folder?

YES!

There are a number of benefits to sharing the WordPress content folder; Both websites will have access to the same themes and plugins. This means that both sites could use a single theme, allowing an easily manageable identical look for two domain names. Media files are saved to the same location, but appear separate in WP. This makes backing up easier.

To accomplish this you need to rearrange things and create symbolic links that go from the old wp-content location to the new shared location. Because I like you, I wrote this quick PHP script to make it easy for you. Simply update the $folderA and $folderB variables to whatever your names are. Then upload the file to your website and run the script in your browser: http://yourwebsite.com/symlink.php. Then delete the file once you are done.

Download the Script

<?php // This script creates two symbolic links that allow two WordPress sites to share one common wp-content folder
 
// Rev 07-06-17
error_reporting (E_ALL);
ini_set ('display_errors', TRUE);
 
// Website A folder name
$folderA = 'mywebsitefolder'; // Existing Website

// Website B folder name
$folderB = 'newsitefolder'; // New website to share content

// Shared content folder name
$content = 'wp-content'; // (at same level as website folders)

// Build paths
$websiteA = $_SERVER['DOCUMENT_ROOT'] . '/' . $folderA;
$contentA = $websiteA . '/wp-content';

$websiteB = $_SERVER['DOCUMENT_ROOT'] . '/' . $folderB;
$contentB = $websiteB . '/wp-content';

$contentShared = $_SERVER['DOCUMENT_ROOT'] . '/' . $content;

// Check if the paths are good...
if( is_dir($contentA) AND is_dir($contentB) ) { //
 
 // Rename the original wp-content folder
 $contentB_Saved = $contentB . '_SAVED';
 if(!rename($contentB , $contentB_Saved) ) { exit('Error: Website B wp-content could not be renamed. Aborting...'); }
 
 // Move WebsiteA's wp-content to root
 if(rename($contentA , $contentShared)) {
 
 // Make the symlinks
 if(symlink($contentShared, $contentA)) {
 
 echo "<p>Symlink A Created: $contentA<br />---&gt; $contentShared</p>";
 
 if(symlink($contentShared, $contentB)) {
 
 echo "<p>Symlink B Created: $contentB<br />---&gt; $contentShared</p>";
 
 echo '<p>' . readlink($contentShared) . '</p>';
 
 exit('Success :-) ');
 
 } else {
 
 exit('Symlink B Could Not Be Created :-(');
 }
 } else {
 
 exit('Symlink A Could Not Be Created :-(');
 }
 } else {
 exit('wp-content could not be copied to root :-(');
 }
} else {
 exit('Directory Read Error :-( ' . $contentB);
}

?>

 

Posted on Leave a comment

How to Publish a WordPress Plugin Using Subversion (SVN)

Dealing with WordPress’ Subversion (SVN) system for publishing plugins is, let’s just say, less than user friendly. Why can’t I just upload a zip file? Anyway, figuring out the command line stuff can be no fun at first. So I hope the 8-step snippet below will help you get a jump start on WordPress SVN plugin publishing and make your first publication a smooth deployment.

 

Steps to SVN-ify Your WordPress Plugin

1) Navigate to your local WordPress plugin repository…

Get to a command prompt and navigate to your plugin’s folder.

cd Distribution/Simple-File-List/wp-ee-simple-file-list

 

2) Update the local WordPress plugin Repo…

svn up

 

3) Back up a bit…

cd ../

 

4) Check Out…

svn co https://plugins.svn.wordpress.org/simple-file-list/ wp-ee-simple-file-list

 

5) Analyze (Optional)

Get Status of Repo

svn stat

See Differences

svn diff

 

6) Add New Plugin Files (if applicable)

svn add trunk/*  (or a filename)

 

7) Tag the New WordPress Plugin Version…

svn cp trunk tags/1.2.3

 

8) Check In Your Changes to the Plugin…

svn ci -m “Simple File List 2 – Major Release”

—–

That is it! Your changes are available instantly.

Posted on Leave a comment

Simple Certain Time to Show Content

This plugin does one simple thing very well. At a time of your choosing show or hide anything enclosed within this shortcode tag:

[[eeSCTSC]]Your content here[[/eeSCTSC]]

  • Set the days of the week and the time of the day to show or hide what’s inside the tags.
  • Set the proper timezone.
  • The content inside the shortcodes can be anything, from a simple message on the page, to a whole Page, Post or Text Widget.
  • Optionally show alternate content (text or HTML) when the main content is not showing.
  • Can be used on a Page, Post in a Text Widget, or in a theme file with do_shortcode()

DOWNLOAD HERE

Posted on Leave a comment

Simple Facebook Meta Tags

Simple Facebook Meta Tags is an ultra-simple, lightweight WordPress plugin that easily fixes poor appearance of shared links to your web pages on Facebook. It requires no setup or configuration, and there is no admin dashboard page. All the proper values are gathered automatically.

DOWNLOAD HERE

This plugin automatically places the most relevant Facebook Open Graph (OG) meta tags into the head section of your web pages.

1. og:site_name = Your website’s title
1. og:url = The link to the current page
1. og:title = The title of the current page
1. og:type = The type of the website; website (Page) or blog (Post or Index)
1. og:description = The first three sentences of the page’s Post content
1. og:image = a link to the most relevant image.

The image chosen is…

1. The Featured Image, or if none…
1. The first Content image, or if none…
1. A default image you upload to your server’s home directory named “facebook_default_image” (.jpg or .png), or if none…
1. The site theme’s custom logo, or if none…
1. The custom header image, or if none…
1. No image meta tag will be output.

The code output looks like this…

Installation

1. Upload the plugin folder to the ‘/wp-content/plugins/’ directory
1. Activate the plugin through the ‘Plugins’ menu in WordPress

DOWNLOAD HERE

 

Frequently Asked Questions

How can I preview what my page will look like when shared on Facebook?

Use the page debugger tool here…

https://developers.facebook.com/tools/debug/sharing/

You can use this to adjust your page and then re-check it until it looks the way you want.

 

I’m not impressed. Why doesn’t the result look like it should?

Make sure you don’t have another plugin, like Jetpack, adding Open Graph tags too.

 

How can I force the link preview and/or image to be different from the page content?

Put a <div> tag at the top of the content area with your text and image within. Then add the CSS style display:none; to the <div>. Now the <div> won’t display on the page, but the meta tags will use this content.

For example:

<div style=”diplay:none;”>
Sentence one. Sentence two. Sentence three.
<img src=”myimage.png” />
</div>

Begin page content…

= How can I ask a question? =

Please contact me here.

= Can I add Twitter tags and others too? =

No, but I can for you. Please contact me.

Changelog

= 1.3 =
* Initial Release to Public

Posted on

Web Application Development

Web-Application-DevelopmentI really enjoy the more complex development project. I had the honor of developing the Vexilar University, an online sales training system. Sales professionals create an account, then go through a series of courses. They watch a video and then take a short quiz. If they pass all of the video courses, they graduate. The system was designed as a mobile-first application, with ample reporting for Vexilar to show how the system is being used.