This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** Put this in your ( for example ) functions.php file. | |
** Credits | |
** http://pastebin.com/qrfjCat8 | |
** http://premium.wpmudev.org/forums/topic/how-to-add-custom-posts-types-in-buddypress-activity | |
*/ | |
function custom_record_activity( $post_id, $post, $user_id = false ) { | |
global $bp, $wpdb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function to be executed when a custom post type is published | |
function run_when_post_published() | |
{ | |
// your function code here | |
} | |
// replace {custom_post_type_name} with the name of your post type | |
add_action('new_to_publish_{custom_post_type_name}', 'run_when_post_published'); | |
add_action('draft_to_publish_{custom_post_type_name}', 'run_when_post_published'); | |
add_action('pending_to_publish_{custom_post_type_name}', 'run_when_post_published'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isset($_GET['activated']) && is_admin()){ | |
$new_page_title = 'This is the page title'; | |
$new_page_content = 'This is the page content'; | |
$new_page_template = ''; //ex. template-custom.php. Leave blank if you don't want a custom page template. | |
$page_check = get_page_by_title($new_page_title); | |
$new_page = array( | |
'post_type' => 'page', | |
'post_title' => $new_page_title, | |
'post_content' => $new_page_content, | |
'post_status' => 'publish', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.datepicker.regional['sv'] = { | |
closeText: 'Stäng', | |
prevText: '< Föregående', | |
nextText: 'Nästa >', | |
currentText: 'Nu', | |
monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'], | |
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'], | |
dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'], | |
dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'], | |
dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Source: http://www.wpbeginner.com/wp-tutorials/55-most-wanted-wordpress-tips-tricks-and-hacks/ ?> | |
<?php include_once(ABSPATH.WPINC.'/feed.php'); | |
$rss = fetch_feed('http://feeds.feedburner.com/wpbeginner'); | |
$maxitems = $rss->get_item_quantity(5); | |
$rss_items = $rss->get_items(0, $maxitems); | |
?> | |
<ul> | |
<?php if ($maxitems == 0) echo '<li>No items.</li>'; | |
else | |
// Loop through each feed item and display each item as a hyperlink. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Based on: http://stackoverflow.com/a/878331 | |
Filter child select from selected parent select option. | |
Will look for parent (options) value in child data-parent"XX". | |
<select id="parent"> | |
<option value="1">Group 1</option> | |
<option value="2">Group 2</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Confirmation modal on elements that have 'confirm' class. | |
// Will launch a modal and ask for confirmation. | |
// data-confirm-action="confirm" - Will enable the confirm modal | |
// data-confirm-title="" - Custom title, optional | |
// data-confirm-text="" - Custom modal text, optional. | |
;(function ( $, window, document, undefined ) { | |
// Create the defaults once | |
var pluginName = "confirmAction", | |
defaults = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import tether.js | |
// We also add 'global.Tether' as a workaround for Meteor. | |
import tether from 'tether'; | |
global.Tether = tether; | |
// Import Bootstrap js. | |
bootstrap = require('bootstrap'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { withStyles, createStyleSheet } from 'material-ui/styles'; | |
import Tabs, { Tab } from 'material-ui/Tabs'; | |
import Paper from 'material-ui/Paper'; | |
const TabStylesheet = createStyleSheet(theme => ({ | |
root: { | |
backgroundColor: theme.palette.background.paper, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: This component requires React 16 or newer. | |
// Usage: | |
/* | |
<Position | |
parent={<div>Parent element</div>} | |
target={ (style) => ( | |
<div style={style}>Popper element</div> | |
)} | |
options={{ |
OlderNewer