Skip to content

Instantly share code, notes, and snippets.

View nathanp's full-sized avatar

Nathan Parikh nathanp

View GitHub Profile
@nathanp
nathanp / Convert Custom Taxonomy to Custom Post Type
Created November 10, 2020 05:01 — forked from Strap1/Convert Custom Taxonomy to Custom Post Type
A very hacky and quick way to transfer a Custom Taxonomy to Custom Post Type and transfer associated metadata to Custom Meta Fields. Note: You can use this if it fits your needs, but it is custom to my set up. Use in a testing environment. It's a plugin with no interface, runs on activation and depending on the amount of data, may hit PHP timeou…
<?php
/*
Plugin Name: Convert Custom Taxonomy to Custom Post Type
Plugin URI: N/A
Description: A plugin to convert a Custom Taxonomy to a Custom Post Type and transfer associated metadata.
Version: 0.1
Author: Strap1
Author URI: http:/www.hiphopinenglish.com
/** Convert Taxonomy '%name%' to CPT '%name%' **/
@nathanp
nathanp / modify-post-type.sql
Created November 4, 2019 23:25
WordPress - MySQL - Update Post Types in Database
UPDATE
wp_posts
SET
post_type = 'resources'
WHERE
post_type = 'media'
@nathanp
nathanp / rock-pending-registration-payments.lava
Created May 29, 2019 19:55
Show a user their registrations with pending payments
<div class="panel panel-default">
<div class="panel-heading">Registrations</div>
<ul class="list-group list-group-panel">
{% registration where:'PersonAliasId == {{ CurrentPerson.PrimaryAliasId }}' %}
{% for reg in registrationItems %}
{% if reg.BalanceDue > 0 %}
<li class="list-group-item">
{{ reg.RegistrationInstance.Name }} <br />
Balance due - {{ reg.BalanceDue | FormatAsCurrency }} <br />
<a href="{{ 'Global' | Attribute:'PublicApplicationRoot' }}Registration?RegistrationId={{ reg.Id }}">Complete Payment</a>
{%metricvalue where:'MetricId == 990' sort:'MetricValueDateTime desc' limit:'1'%}
{% for metricvalue in metricvalueItems %}
{% capture currentWorshipAttendance %}{{ metricvalue.YValue | Format:'#,##0' }}{% endcapture %}
{% endfor %}
{% endmetricvalue %}
{%metricvalue where:'MetricId == 1117' sort:'MetricValueDateTime desc' limit:'1'%}
{% for metricvalue in metricvalueItems %}
{% capture currentChapelAttendance %}{{ metricvalue.YValue | Format:'#,##0' }}{% endcapture %}
{% endfor %}
{% endmetricvalue %}
@nathanp
nathanp / Button that links to Connect Group report.lava
Created February 12, 2019 23:06
Only visible if the current person is a leader of the group being viewed. Relies on query strings.
@nathanp
nathanp / Connect Group Follow Up.lava
Last active February 12, 2019 23:43
Follow up for Connect Group Leaders
<script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready( function () {
$('#CGFollowUp').DataTable( {
paging: false,
"searching": false,
"order": [3, 'asc'],
"info": false
} );
} );
@nathanp
nathanp / pathway.lava
Last active February 6, 2019 22:45
RockRMS - Discipleship Pathway
<div class="row">
<div class="col-sm-12">
<div class="persondetails-group">
<header>
<h1>Hallmark's Discipleship Pathway</h1>
</header>
</div><!-- .persondetails-group-->
</div>
<div class="panel panel-block">
<div class="panel-heading">
<h4 class="panel-title">Important Events</h4>
</div>
<div class="">
{% eventcalendaritem where:'EventCalendarId == 1' %}
<ul class="list-group list-group-panel">
{% for eventcalendaritem in eventcalendaritemItems %}
{% if eventcalendaritem.EventItem.IsActive == true %}
{% assign level = eventcalendaritem | Attribute:'EventLevel' %}
@nathanp
nathanp / Adult Connect Groups Count.lava
Last active November 11, 2019 16:47
RockRMS - Metric SQL and Lava
{% assign previousSunday = 'Now' | SundayDate | DateAdd:-7 | Date:'M/dd/yyyy' %}
Metric Date: {{ previousSunday }}
<br />
{% group where:'ParentGroupId == 49 || ParentGroupId == 10603 && IsActive == true' %}
{% for group in groupItems %}
{% attendance where:'DidAttend == true && GroupId == {{ group.Id }} && SundayDate == "{{ previousSunday }}"' count:'true' %}
{% if count > 0 %}
Metric Partition: {{ group.Name }}
<br />
Metric Value: {{ count }}
@nathanp
nathanp / dl-file.htaccess
Created April 5, 2017 18:49
Sample .htaccess configuration to use the dl-file.php from https://gist.github.com/nathanp/50e76eb23a3f084cce4205657ee71acc
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# BEGIN THIS DL-FILE.PHP ADDITION