Skip to content

Instantly share code, notes, and snippets.

View Sidsector9's full-sized avatar

Siddharth Thevaril Sidsector9

View GitHub Profile
@Sidsector9
Sidsector9 / url_to_attachment.php
Last active January 30, 2020 21:51
Gravity forms set featured image using Standard and Advanced fields through URL to attachment conversion
<?php
add_action( 'gform_after_submission', 'upload_photo', 10, 2 );
function convert_to_attachment( $entry, $form ) {
// ID of the title field
$title = rgar( $entry, 1 );
// ID of the upload button
$url = rgar( $entry, 2 );

Learn these concepts

Basics:

  1. Variables
    • Types (Data type)
    • Local vs Global Variables
    • Scope of a variable
  2. Comments
  • Single line comment
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1><?php echo $_GET['username'] ?></h1>
<?php
$file = 'file.csv';
$handle = fopen( $file, 'r' );
admin_init
- register_setting( $option_group, $option_name )
- add_settings_*()
display hidden fields and security
- settings_fields( $option_group ) [ Same parameter passed to register_setting() ]
display sections
- do_settings_section( $page )
<?php
/**
* First we will create a settings page and add the name of the page to the
* admin dashboard
* Hook to be used in `admin_menu`
*/
add_action( 'admin_menu', 'wpgf_menu_page_setup' );
function wpgf_menu_page_setup() {
add_menu_page(
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "sftp",
"save_before_upload": true,
"upload_on_save": true,
"sync_down_on_open": false,
<?php
/**
* Adding a settings field in the already existing settings
* page: general.
*/
add_action( 'admin_init', function() {
/**
* To create a settings field, it needs to be registered first.
* Here we register a settings field called 'brand-name'.

Frontend UI testing

The frontend UI testing tests whether the contents of Give's features display and function as intended. These tests don't focus on the aesthetics but rather tests the correct output on the webpage and the interactions with it.

How to run the tests?

A sample wordpress.sql is provided within sample-data/ folder which has few sample forms, donations and donors to test in various combinations.

Manual Testing

After setting up the local development environment, running tests manually is fairly simple. All you need it to run

@Sidsector9
Sidsector9 / web-dev-2018.md
Last active April 17, 2019 14:58
Web Development Tools 2018

Rapid Web Development 2018

1. Grunt vs Gulp vs Webpack

Although Grunt and Gulp are both popular task runners, the Web Development community has moved to module bundlers such as Webpack since it can accomplish the same task as Grunt and Gulp, and in addition to that it can do a lot more.

The benefit of using Webpack is that it enables to work on projects as modules. We can have one webpack.config.js file for every project and use it as a starting point. It will achieve:

  • Code modularization
  • Transpiling ES6 to ES5
  • SCSS to CSS
  • Bundle all JS files into 1 .js file