Skip to content

Instantly share code, notes, and snippets.

View robwent's full-sized avatar
💭
Doing 'stuff'

Robert Went robwent

💭
Doing 'stuff'
View GitHub Profile
@robwent
robwent / divi-media-queries.css
Created November 22, 2017 18:11
All the media queries found in the Wordpress Divi theme (Typos copied verbatim)
/* Responsive Styles Large Desktop And Above */
@media all and (min-width: 1405px) {
}
/* Responsive Styles Standard Desktop Only */
@media all and (min-width: 1100px) and (max-width: 1405px) {
}
@robwent
robwent / select-posts-by-cat-id.sql
Created January 10, 2018 18:16
Select Wordpress posts by category ID
SELECT * FROM wp_posts
LEFT JOIN wp_term_relationships ON
(wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy ON
(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
WHERE wp_posts.post_type = 'post'
AND wp_term_taxonomy.taxonomy = 'category'
AND wp_term_taxonomy.term_id = 48
ORDER BY post_date DESC
@robwent
robwent / joomla-email-404.php
Created March 10, 2018 11:13
Email notification for broken links for Joomla. Add to your templates error.php file.
<?php
// Check for a referer and if so send mail
if (isset($_SERVER["HTTP_REFERER"])){
$sitename = "My Website";
// Mail Settings
$mailer = JFactory::getMailer();
// Set sender as site default
$config = JFactory::getConfig();
$sender = array(
$config->get('config.mailfrom'),
@robwent
robwent / remove-woo-noindex-public-pages.php
Created April 25, 2018 12:02
Removes WooCommerce noindex robots tag on public pages
function YOURPREFIX_remove_wc_account_page_noindex(){
if (!is_user_logged_in()) {
remove_action( 'wp_head', 'wc_page_noindex' );
}
}
add_action( 'init', 'YOURPREFIX_remove_wc_account_page_noindex' );
@robwent
robwent / rootpath.php
Created May 18, 2018 23:24
Drop into a folder to find the server root to the file
<?php
echo $_SERVER['DOCUMENT_ROOT'];
?>
@robwent
robwent / mailcheck.php
Created May 18, 2018 23:26
Drop in a folder and browse to it to check php mail is working.
<?php
$to = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Email successfully sent!</p>");
} else {
echo("<p>Email delivery failed!</p>");
}
?>
@robwent
robwent / wp-config.php
Last active July 19, 2023 09:45
Wordpress live debug settings
<?php
//define( 'WP_DEBUG', false );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
@robwent
robwent / recipe_form.js
Created December 12, 2018 13:34
WordPress 5 WP Ultimate Recipe Fix
function WpUltimateRecipeGutenbergEditorLoaded() {
return ( wp.data !== undefined && wp.data.select( 'core/editor' ) !== undefined );
}
// TODO WordPress 5.0 Gutenberg fix. Get rid once fixed in core.
if (WpUltimateRecipeGutenbergEditorLoaded() && window.tinymce) {
wp.data.subscribe(function () {
// the post is currently being saved && we have tinymce editors
if (wp.data.select( 'core/editor' ).isSavingPost() && window.tinymce.editors) {
for (var i = 0; i < tinymce.editors.length; i++) {
@robwent
robwent / ispconfig-proxy.conf
Created January 19, 2019 20:31
Proxy ISPConfig secure domain to the hosting panel port.
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine On
ProxyRequests On
ProxyPreserveHost On
ProxyPass /stats !
ProxyPass / https://127.0.0.1:8080/
@robwent
robwent / .htaccess
Created March 7, 2019 21:06
Redirect a URL that has a query string
# Redirects /index.php?option=com_content&task=view&id=59&Itemid=69
RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=59&Itemid=69$
RewriteRule ^index\.php?$ https://domain.com/page? [R=301,L]