Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@alinademi
alinademi / keybindings.json
Last active December 15, 2022 23:25 — forked from airyboy/keybindings.json
Use vim like keybindings ctrl+shift+j, ctrl+shift+k, ctrl+shift+l for intellisense (suggestion menu) in VSCode
{
"key": "ctrl+shift+j",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "ctrl+shift+k",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
}
@alinademi
alinademi / functions.php
Created December 10, 2022 04:57 — forked from barbwiredmedia/functions.php
Wordpress SEO Yoast Order meta box. This will change the priority of Yoasts meta box and move it to the bottom of all pages / posts.
// Move Yoast Meta Box to bottom
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
@alinademi
alinademi / close-yoast-metabox.php
Last active January 10, 2023 05:41 — forked from mikeott/close-yoast-metabox.php
Force the Yoast metabox to be closed by default.
function collapse_yoast_matabox()
{
if (!class_exists('WPSEO_Metabox')) {
return;
}
echo /*html*/ '
<script>
document.addEventListener("DOMContentLoaded",
function(event) {
document.querySelector(".yoast.wpseo-metabox").classList.add("closed");
@alinademi
alinademi / laravel-nova-authorized.php
Created August 29, 2022 05:00 — forked from dev-lav/laravel-nova-authorized.php
laravel-nova-authorized.php
<?php
// add this code on your nova resource
public function authorizedToUpdate(Request $request)
{
return false;
}
public function authorizedToDelete(Request $request)
@alinademi
alinademi / homebrew-permissions-issue.md
Created July 26, 2022 16:31 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@alinademi
alinademi / extend-wp-rest-api.php
Created July 13, 2022 23:31 — forked from mahlamusa/extend-wp-rest-api.php
Extend WordPress REST API with custom rest fields and endpoints
<?php
/**
* Register custom rest fields
*/
add_action( 'rest_api_init', 'register_custom_fields' );
/**
* Register rest fields and endpoint
*
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
@alinademi
alinademi / expose_ACF_fields_to_REST.php
Created June 2, 2022 18:48 — forked from MelMacaluso/expose_ACF_fields_to_REST.php
Automatically expose all the ACF fields to the Wordpress REST API in Pages and in your custom post types.
<?php
function create_ACF_meta_in_REST() {
$postypes_to_exclude = ['acf-field-group','acf-field'];
$extra_postypes_to_include = ["page"];
$post_types = array_diff(get_post_types(["_builtin" => false], 'names'),$postypes_to_exclude);
array_push($post_types, $extra_postypes_to_include);
foreach ($post_types as $post_type) {
register_rest_field( $post_type, 'ACF', [
// Adding Custom Configuration field in LearnDash Topics
add_filter( 'learndash_post_args', 'add_topic_option' );
function add_topic_option( $post_args ) {
global $pagenow;
$topic_id = $_GET['post'];
// If in Topic Edit Screen
if ( $pagenow == 'post.php' && get_post_type( $topic_id ) == 'sfwd-topic' ) {
@alinademi
alinademi / activate_groupal_membership_for_members.php
Created May 30, 2022 21:22 — forked from Hypegrow/activate_groupal_membership_for_members.php
Activar membresías grupales para miembros del grupo en LearnDash
<?php
add_filter('sfwd_lms_has_access', function ($return, $post_id, $user_id) {
$return = false;
if (empty($user_id)) {
if (!is_user_logged_in()) {
return false;
} else {