Replacing string with a variable in php

I have following code in my plugin of WordPress: wp_localize_script(‘ffd_js_script’, ‘myAjax’, array( ‘ajaxurl’ => admin_url(‘admin-ajax.php’), ‘idinfo’ => $myoptionValue[idinfo], ‘index1’ => $myoptionValue[id1], ‘index2’ => $myoptionValue[id2] ) ); I want to replace ‘index1’ => $myoptionValue[id1], ‘index2’ => $myoptionValue[id2] with for($i=1; $i<= $myoptionValue[fieldcount]; $i++) { $arguments .= ‘, »index »‘.$i.’=>’.$myoptionValue[id.$i]; } So that I have wp_localize_script(‘ffd_js_script’, ‘myAjax’, array( ‘ajaxurl’ => admin_url(‘admin-ajax.php’), ‘idinfo’ => $myoptionValue[idinfo] $arguments ) ); Apparently I’m thinking it might be as simple as this, but it isn’t, where is my mistake? EDIT: full code: require( plugin_dir_path( __FILE__ ) . ‘menu.php’); require_once( plugin_dir_path(…

Web Design Weekly #151

Headlines Duo Duo is a next-generation package manager that blends the best ideas from Component, Browserify and Go to make organising and writing front-end code quick and painless. (duojs.org) Living with Web Apps (paul.kinlan.me) Articles Opinionated Rundown of JS Frameworks This article by Henrik Joreteg gives a very good overview of some of the most popular JavaScript tools and frameworks for building single page apps today. (blog.andyet.com) Modern Style Guides for Web Design and Development Morten Rand-Hendriksen explains why style guides for design and development should be at the core…

I can’t preview post’s change once they are published

The preview function works fine when posts are just draft. The url looks like this : http://exemple.domain.com/blog/?p=12&preview=true Then when I pubish my posts, let’s say I want to change something and preview it, the url looks like this : http://exemple.domain.com/blog/my-article-title/?preview=true&preview_id=12&preview_nonce=514e88946a&post_format=standard The problem is it does reflect any changes … I use WordPress 3.9.2 running Twenty Fourteen theme without any plugins EDIT I’ve turn the permalink to default and it resolve the problem. But I need it to work using the pretty url … Thanks for your help Source: https://wordpress.stackexchange.com/feeds

Introduction to SUIT CSS

The ever daunting question we as developers face is “How am I gonna structure things for a project?” As a framework, SUIT CSS provides an implementation of an architecture that others can use as the basis for a working application. Think of it as a guiding path giving structure to chaos, reducing helplessness/fear and enforcing design principles where CSS tends to lack (compared to other languages like JavaScript that enforces rules and throws errors). With SUIT authors are provided with a reliable and testable styling methodology for component-based UI development.…

wp_trim_words is trimming by character instead of by words

I’m using WordPress 3.9.2, and having trouble with the wp_trim_words function. It seems to be cutting the string down to X characters instead of X words. Example Put the following in a template file: <?php $str = « Imagine discovering a secret language spoken only online by a knowledgeable and learned few. Over a period of weeks, as you begin to tease out the meaning of this curious tongue and ponder its purpose, the language appears to shift in subtle but fantastic ways, remaking itself daily before your eyes. And just…

Web Design Weekly #150

Headlines Enduring CSS A great article by Ben Frain that looks at the most advantageous practices and approaches when authoring CSS for a large, rapidly changing site. Make time for this one! (benfrain.com) CSS Guidelines High-level advice and guidelines for writing sane, manageable, scalable CSS From Harry Roberts. (cssguidelin.es) Articles Speeding up AngularJS apps with simple optimisations AngularJS is a huge framework that already has many performance enhancements built in, but they can’t solve all our problems. In this article Todd Motto points out some things to help build faster…

Ajax without jQuery

Like many before me, I was introduced to jQuery before I was even remotely proficient in vanilla JavaScript. And while I think a web designer can do very well with basic jQuery skills, the further one moves into web development, the more important it is to have an understanding of plain JavaScript. Since coming to understand this, I’ve put myself on a strict no-jQuery diet, in order to better understand the language. So far, I have learned a lot, one of the many lessons being just how much work jQuery…

How do you create dynamic customised sections in WordPress?

I am very new to WordPress and I just like to ask a fundamental question about its structure. I understand that WordPress uses different files as templates for different sections or types of pages. What I’d like to know is what if I have certain parts within the page that contains other bits of data like in the image below (the ones with the question marks): Let’s say, referring to the image above, that the 3 boxes in a row will display reviews and the 2 boxes in a row…

Dumping variable in custom pre_gets_post function in functions.php, returns NULL

Problem Summary: I am using firePHP to analyze my variables in a custom function, but it does not display their contents into the console as I would expect. I also used var_dump(), it returns NULL. Problem Details: I am using firePHP exactly as described by @brasofilo as seen on https://wordpress.stackexchange.com/a/71599/41479 . It is normally very helpful, but I am confused why sometimes I cannot see contents of my variables in the console. Here is a specific example, this is in page-sr2.php: <?php get_header(); ?> <div id= »main »> <div id= »primary »> <div id= »content »…

Combining custom taxonomy posts with default posts on one archive page

I’m trying to get custom archive posts and default posts combined onto one archive page which I have managed… sort of but I can’t get pagination to work either using the pagenavi plugin or the themes default pagination code. I have tried using paged but if anything did show I’m then not sure it would page both categories together or just one. I need to combine two categories, one a custom taxonomy, the other the default and then have them styled differently and have a set number of the combined…