Skip to content

Instantly share code, notes, and snippets.

@mwordpress
mwordpress / VimeoController.php
Created October 27, 2018 11:51
Vimeo Video Download Links -- Work with wordpress
/*
* Usage :
* $video = new VimeoController;
* $data = $video->getVideoDownloadLink('https://vimeo.com/276013718');
* print_r($data);
*
*/
class VimeoController {
/*
* Get the video information
@mwordpress
mwordpress / gist:1d04f842ea6895094de780071cd16dc8
Last active November 22, 2017 23:56 — forked from rodica-andronache/gist:54f3ea95bcaf76435e55
color picker in wordpress widget
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 09:43
add custom field to all post based on post thumbnail
<?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 );
/****** 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
$query->set('cat', '-1,-2,-3,-4,-5');
if ( $query->is_archive ) {
if ( $query->is_home || $query->is_archive) {
<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>
@mwordpress
mwordpress / scheduled-posts.php
Created February 12, 2017 05:21
this codes listed here is part of the following article : https://www.mwordpress.net/display-scheduled-posts-in-sidebar/
<?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();
<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>
<?php
/*
Template Name: Full Archive
*/
?>
<?php
/**
* The template for displaying pages
*
* This is the template that displays all pages by default.
<?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