Skip to content

Instantly share code, notes, and snippets.

@rali14
rali14 / style.css
Last active October 31, 2020 02:19
Force LearnDash Videos to be Responsive
/*
* Custom CSS to make videos responsive
* Original code from: https://avexdesigns.com/responsive-youtube-embed/
*/
.ld-video {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0;
overflow: hidden;
@rali14
rali14 / .php
Created May 10, 2019 20:40
Hide the license key within LearnDash
/*
* Temporary function to hide the license key entered for LearnDash LMS
* Add the below to your child theme's functions.php file or as a code snippet using a third party plugin such as: https://en-ca.wordpress.org/plugins/code-snippets/
*/
function ld_hide_license_key() {
echo '"<script type="text/javascript">jQuery( "#nss_plugin_license_sfwd_lms" ).val( "**********" );</script>"';
}
add_action('admin_footer', 'ld_hide_license_key');
@rali14
rali14 / functions.php
Created February 22, 2017 17:51
Add opentable field to the backend
// Add your own function to filter the fields
add_filter( 'job_manager_job_listing_data_fields', 'custom_job_manager_job_listing_data_fields' );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/admin/class-wp-job-manager-writepanels.php
function custom_job_manager_job_listing_data_fields( $fields ) {
// Here we target one of the job fields (location) and change it's placeholder
$fields['job']['opentable']['label'] = "OpenTable Embed";
@rali14
rali14 / functions.php
Created February 22, 2017 17:47
OpenTable to Listify - Front End
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/forms/class-wp-job-manager-form-submit-job.php
function custom_submit_job_form_fields( $fields ) {
// Here we target one of the job fields (job_title) and change it's label
$fields['job']['opentable']['label'] = "OpenTable Embed"; // Notice I changed this to open table field.
@rali14
rali14 / backup.php
Created February 8, 2017 20:00
Content-Joblisting
<?php
/**
* The template for displaying job listings (in a loop).
*
* @package Listify
*/
?>
<li itemscope itemtype="http://schema.org/LocalBusiness" id="job_listing-<?php the_ID(); ?>" <?php echo apply_filters( 'listify_job_listing_data', '', false ); ?>>
@rali14
rali14 / single.php
Created December 29, 2016 16:42
old Single Listings Template
<?php
/**
* The Template for displaying all single posts.
*
* @package Listify
*/
get_header(); ?>
@rali14
rali14 / functions.php
Last active November 30, 2016 17:53
Display hero button if meta key is not empty
<?php
/**
* Plugin Name: Listify - Custom Single Listing Hero Button
*/
function custom_listify_single_job_listing_actions_after() {
global $post;
$url = get_post_meta( $post->ID, 'your_custom_meta_key', true );
if ($url != "") {
@rali14
rali14 / tmpl-infobubble.php
Created November 1, 2016 16:18
Jobify Map Bubble Template
<script id="tmpl-infoBubble" type="text/template">
<a href="{{{ data.link }}}">
<# if ( typeof( data.thumb ) != 'undefined') { #>
<span style="background-image: url({{{ data.thumb }}})" class="list-cover has-image"></span>
<# } #>
<# if ( typeof( data.title ) != 'undefined') { #>
<h1>{{{ data.title }}}</h1>
<# } #>
@rali14
rali14 / functions.php
Last active October 21, 2016 15:18
Redirect users after registration
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
$role = $user->roles[0];
@rali14
rali14 / job_application.php
Created October 19, 2016 19:54
Redirect URL based application directly to site
<?php if ( $apply = get_the_job_application_method() ) :
wp_enqueue_script( 'wp-job-manager-job-application' );
?>
<div class="job_application application">
<?php do_action( 'job_application_start', $apply ); ?>
<?php if ( 'url' == $apply->type ) : ?>
<a class="button" href="<?php echo esc_url( $apply->url ); ?>" target="_blank" rel="nofollow" style="padding:1em;">Apply for job</a>
<?php else : ?>
<input type="button" class="application_button button" value="<?php _e( 'Apply for job', 'wp-job-manager' ); ?>" />