PHP Use Declared array Variable inside already Declared Array

This is more a generic PHP question than anything to do with WordPress, but I’d suggest setting the value in the constructor: class test { public $basicCols; public $optList = array( ‘one’ => ‘One’, ‘two’ => ‘Two’ ); function __construct() { $this->basicCols = array( array( ‘title’ => ‘KEY’, ‘field’ => ‘slug’, ‘options’ => $this->optList ), … Read more

Can’t get options with $data[‘variable’]

This is actually a PHP question, and not a WordPress question. The issue is that global variables don’t pass through the include()/require() call from the template file into header.php. The solution is to define $data after you globalize it. Without knowing your options framework or your Theme specifically, I can only answer in general terms; … Read more

Shortcode not passing variable to included file

Ok, so somehow I got it working by changing it to this: It looks like it didn’t like ‘the_clientId’. Maybe it just doesn’t like capital letters???? [insert-form form_location=”form.php” identification_number=”12345″] function insert_the_form($atts){ $form_base = plugin_dir_path(__DIR__); // Shortcode attributes & options $atts = shortcode_atts( array( ‘form_location’ => ‘NULL’, ‘identification_number’ => ‘NULL’ //Variable for client ID ), $atts, … Read more

Get attachment if matches a variable

$attachments holds array of posts, you are missing something like: $attachment = $attachments[0]; or foreach( $attachments as $attachment ) Update Nope, like this: foreach( $attachments as $attachment ) if ($attachment->post_title == $programme) { echo the_attachment_link($post->ID, false); break; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)