Skip to content

Instantly share code, notes, and snippets.

@mwordpress
mwordpress / VimeoController.php
Created Oct 27, 2018
Vimeo Video Download Links -- Work with wordpress
View VimeoController.php
/*
* Usage :
* $video = new VimeoController;
* $data = $video->getVideoDownloadLink('https://vimeo.com/276013718');
* print_r($data);
*
*/
class VimeoController {
/*
* Get the video information
View gist:1d04f842ea6895094de780071cd16dc8
class Color_Picker_Widget_25809 extends WP_Widget {
/**
* Widget constructor.
*
* @since 1.0
*
* @access public
*/
public function __construct() {
@mwordpress
mwordpress / update-thumbnail.php
Created May 13, 2017
add custom field to all post based on post thumbnail
View update-thumbnail.php
<?php
include '../../../wp-load.php';
$args = array(
'posts_per_page' => -1,
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true,
);
$posts_array = get_posts( $args );
View math_comment_spam_protection
/****** Math Comment Spam Protection Plugin ******/
if ( function_exists('math_comment_spam_protection') && !$user_ID ) {
$mcsp_info = math_comment_spam_protection();
?>
<input type="text" name="mcspvalue" id="mcspvalue" value="" size="22" tabindex="4" />
<label for="mcspvalue"><small>كم مجموع <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?> (مطلوب) </small></label>
<input type="hidden" name="mcspinfo" value="<?php echo $mcsp_info['result']; ?>" />
<?php
View edit.php
$query->set('cat', '-1,-2,-3,-4,-5');
if ( $query->is_archive ) {
if ( $query->is_home || $query->is_archive) {
View adsense-responsive.html
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-XXXXXXXXXXXXXXX"
data-ad-slot="XXXXXXXXXX"
data-ad-format="auto">
</ins>
<script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
View scheduled-posts.php
<?php
$param = array(
'post_status' => 'future',
'order' => 'ASC',
'post_per_page' => '5'
);
$scheduled_posts = new WP_Query($param);
if ($scheduled_posts->have_posts()) :
while ($scheduled_posts->have_posts()) : $scheduled_posts->the_post();
View media.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /media/
RewriteRule ^resizer/(.*)x(.*)/r/(.*) resizer/resize.php?src=http://sitename.com/wp-content/uploads/$3&h=$2&w=$1&zc=0&s=1
</IfModule>
View archive-full.php
<?php
/*
Template Name: Full Archive
*/
?>
<?php
/**
* The template for displaying pages
*
* This is the template that displays all pages by default.
View create_feed_data.php
<?php
/*
* Generate feedburner urls
*/
function create_feed_data($feed_list) {
// create feed url for each category in given array
foreach($feed_list as $feed_slug => $feed_name) {
$feed_url = $feed_slug;
}
// create html input feed for each category in given array
You can’t perform that action at this time.