Skip to content

Instantly share code, notes, and snippets.

View Sidsector9's full-sized avatar

Siddharth Thevaril Sidsector9

View GitHub Profile
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 )
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1><?php echo $_GET['username'] ?></h1>
<?php
$file = 'file.csv';
$handle = fopen( $file, 'r' );

Learn these concepts

Basics:

  1. Variables
    • Types (Data type)
    • Local vs Global Variables
    • Scope of a variable
  2. Comments
  • Single line comment
@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 );