• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

PHP Code

The tutorials in this archive help people read, write & use PHP code in Genesis child themes.

template_include

Using the template_include function included in WordPress, paste this PHP code at the end of your child themes functions.php file and modify

PHP Functions

get_body_class

This free code checks the body classes and executes your code if the body class exists. In this case, the code executes on any page which

PHP Functions

if else

if .... else is used as a conditional statement or conditional expression which enables you to execute code if a specific condition returns

PHP Functions

array

There's 3 types of functions which use array() out of the dozens of different array functions you can use in PHP. This tutorial explains

PHP Functions

class_exists

You can use class_exists to check if a plugin is active. ( Watch the video below which tests the code examples in this tutorial ). You

Custom Fields PHP Functions

foreach

The foreach construct only works with arrays. This means you must either use an array like this: array( '1', '2', '3' ); Or functions

PHP Functions

sprintf

sprintf is similar to printf however is used to return the result as a value for a variable to be used later rather than output

PHP Functions

add_action

add_action is a function which you'll see in WordPress, Genesis & other theme files. You've probably seen code in a file which looks

Action Hooks PHP Functions

printf

You've probably seen code in your files which looks like this: [code] printf('%s World', $var ); [/code] This code includes a function

PHP Functions

variable

You've probably seen code which includes the $ dollar sign like this: [code] $output [/code] This is whats called in PHP language, a

PHP Functions

Ternary Operator

There's at least 3 ways to code if conditionals and else statements in WordPress using PHP. In the first 2 examples below, we'll use the

PHP Functions

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.