Skip to content

Instantly share code, notes, and snippets.

@nelsonogueh
nelsonogueh / functions.php
Created February 25, 2021 06:36 — forked from danieljwonder/functions.php
Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce
<?php
/* Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce */
/* Add Courses Link to My Account menu */
add_filter ( 'woocommerce_account_menu_items', 'wc_ld_link', 40 );
function wc_ld_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'courses' => 'My Courses' )
+ array_slice( $menu_links, 5, NULL, true );
@nelsonogueh
nelsonogueh / LearnDash Profile to My Account
Created February 25, 2021 06:37 — forked from gsibert/LearnDash Profile to My Account
Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce
/* Add LearnDash Profile to My Account Tab in WooCommerce */
/* Add Courses Link to My Account menu */
add_filter ( 'woocommerce_account_menu_items', 'wc_ld_link', 40 );
function wc_ld_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'courses' => 'My Courses' )
+ array_slice( $menu_links, 5, NULL, true );
return $menu_links;
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
@nelsonogueh
nelsonogueh / gist:adc6b74c86118fe024273575c61c8125
Created April 16, 2021 03:36 — forked from mikejolley/gist:2176823
WooCommerce - Show products from current product category (when viewing a single product)
<?php
if ( is_singular('product') ) {
global $post;
// get categories
$terms = wp_get_post_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) $cats_array[] = $term->term_id;
import jwt from 'jsonwebtoken';
import User from '../models/User';
class SessionController {
async store(req, res) {
const { email, password } = req.body;
const user = User.findOne({ where: { email } });
@nelsonogueh
nelsonogueh / manual_paginate.php
Created July 13, 2022 13:34 — forked from nellytadi/manual_paginate.php
Manual Paginate In Laravel
<?php
namespace App\Http\Controllers\Api;
use App\Model;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Pagination\LengthAwarePaginator as Paginator;
@nelsonogueh
nelsonogueh / host-react-app-on-apache-server.md
Created October 11, 2022 23:54 — forked from ywwwtseng/host-react-app-on-apache-server.md
Host react application on Apache server

Host react application on Apache server

Step 1 : Create your app

$ npm install -g create-react-app 
$ create-react-app my-app

Step 2 : Build it for production

@nelsonogueh
nelsonogueh / upload-a-file.MD
Created December 19, 2022 23:44 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@nelsonogueh
nelsonogueh / page-forgot-password.php
Created December 20, 2022 11:54 — forked from jshakes/page-forgot-password.php
One-page WP password reset page (for themes with front-facing bespoke log-in)
<?php
/*
Lets you display a forgot/reset password page within your theme.
Eg, create a page called 'Forgot Password'; save this file as page-forgot-password.php
Adapted from code posted here: http://wordpress.stackexchange.com/questions/14692/check-for-correct-username-on-custom-login-form/14696#14696
*/