Skip to content

Instantly share code, notes, and snippets.

@greg-randall
greg-randall / Wordpress Export Notes
Last active January 24, 2022 19:24
Export all content from Wordpress but evaluate shortcodes before exporting.
I'm using this to get away from Enfold and Devi which marks everything up with hundreds of shortcodes. This will output ugly html, but at least it's html.
In wp-admin/includes/export.php change this line:
$content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
To:
$content = wxr_cdata( apply_filters( 'the_content_export', do_shortcode( $post->post_content ) ) );
@greg-randall
greg-randall / html-clean.php
Last active March 1, 2019 18:03
Remove all html attributes except for the url of images and urls on links. It then cleans up html removing divs, spans, etc. Ideally used if you have a source of HTML from an existing site with a bunch of CSS classes you don't need.
<?php
if(!isset($_POST["input"])|$_POST["input"]==""){ //check to see if the url is set. if not set prompts for a url.
?>Clean:
<form action="index.php" method="post">
<textarea name="input" rows="40" cols="80"></textarea><br><br>
<input type="submit">
</form><?php
exit();
}else{
$input = htmlspecialchars_decode($_POST["input"]);
@greg-randall
greg-randall / index.php
Last active December 1, 2022 15:42 — forked from vsoch/index.php
Generate RSS feed for files in a directory folder. Put this file in a folder with files, modify the $allowed_ext variable to customize your extensions, and $feedName, and $feedDesc. Then navigate to the folder on the web to see the xml feed.
<?php
header("Content-type: text/xml");
$feed_name = "My Audio Feed";
$feed_description = "Feed for the my audio files in some server folder";
$base_url = strtok('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], '?'); //gets the current page's url. strips off the url's parameters
$allowed_extensions = array('mp4','mp3');
?>
<?php echo '<?xml version="1.0"?>'; //we have to use php to output the "<?" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">