Skip to content

Instantly share code, notes, and snippets.

View tpitre's full-sized avatar
💭
🍕

TJ Pitre tpitre

💭
🍕
View GitHub Profile
@tpitre
tpitre / wp-image-import.php
Last active September 23, 2020 20:23
WP image fetching and attaching to post
function process_image() {
$response = '';
$data[] = '';
$error = 0;
if ( isset( $_POST['ids'] ) )
$ids = $_POST['ids'];
$data['choose-tool'] = $_POST['args'];
<item>
<title>3-Cheese Stuffed Shells with Roasted Red Pepper Sauce</title>
<link>http://cleaneating.vip.lndo.site/recipe/3-cheese-stuffed-shells-with-roasted-red-pepper-sauce/</link>
<pubDate>Fri, 04 Sep 2020 16:43:17 +0000</pubDate>
<dc:creator><![CDATA[cleaneating]]></dc:creator>
<guid isPermaLink="false">http://cleaneating.vip.lndo.site/?post_type=recipe&#038;p=14153</guid>
<description></description>
<content:encoded><![CDATA[<!-- tml-version="2" -->
<img src="http://cleaneating.vip.lndo.site/wp-content/uploads/sites/6/2013/11/3-cheese-stuffed-shells-with-roasted-red-pepper-sauce.jpg" alt="3-Cheese Stuffed Shells with Roasted Red Pepper Sauce" data-attribution="Photo by Yvonne Duivenvoorden" title="3-Cheese Stuffed Shells with Roasted Red Pepper Sauce" />
]]></content:encoded>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.2/"
>
<channel>
<title>Clean Eating</title>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
@tpitre
tpitre / hero-image
Created April 11, 2019 18:51
WP Picture Tag Usage
<?php
$img_id = get_post_thumbnail_id();
$img_featured_s = wp_get_attachment_image_src($img_id, "article-hero-s");
$img_featured_m = wp_get_attachment_image_src($img_id, "article-hero-m");
$img_featured_l = wp_get_attachment_image_src($img_id, "article-hero-l");
if (!empty($img_featured_s)) {
$alt = get_post_meta($img_id, '_wp_attachment_image_alt', true);
$caption = get_post(get_post_thumbnail_id())->post_excerpt;
$credit = get_field('photo_credit', $img_id);
@tpitre
tpitre / smartling-video-embed
Created December 19, 2018 18:24
Smartling Video Embed
<div class="embedly-responsive" style="position: relative; padding-bottom: 33.33%; height: 0; overflow: hidden;"><iframe class="embedly-embed" frameborder="0" scrolling="no" allowfullscreen src="PATH/TO/VIDEO/EMBED/HERE" width="1920" height="800" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>