WordPress HTML Helper

The short answer is that there isn’t one. WordPress templating consists mostly of raw PHP and Template Tags API. The API is more focused on outputting specific content, than producing specific HTML. As result the technique is pretty much unknown in WordPress development. It doesn’t mean that you can’t use one, but it’s just not … Read more

How to get html tag ids from template?

WordPress doesn’t operate with DOM for the purpose of page source generation from templates. Templates are treated and run as PHP source files, producing any and all output. Unless you have control over actual templates your options likely are: Attempting to buffer and rewrite output (rather fragile, more so for publicly released plugin) Adjust markup … Read more

Finding and removing unnecessary redirects

While in the process of implementing a CSP and defining the allowed sources, I was shocked to find the total number of resources ShareThis calls. At the time of writing this, I counted a total of 39 domains and subdomains it uses. Not a big surprise anymore why ShareThis was causing my slow page load … Read more

Pass the updated value of aid from form using ajax

I’m a bit confused – why the two submit buttons? And you’re outputting the same id multiple times (inside a foreach loop), which will choke jQuery. Try the following, using classes: $form = ”; foreach ( $results as $result ) { $value = esc_attr( $result->aid ); $form .= ‘<form method=”post” class=”aid-form”>’; $form .= “<input name=”aid” … Read more

Add extra markup to WP menus

When developing a menu on a bootstrap based theme, I now use the following Walker: ‘walker’ => new Custom_Walker_Nav_Menu class Custom_Walker_Nav_Menu extends Walker_Nav_Menu { // add classes to ul sub-menus function start_lvl( &$output, $depth ) { // depth dependent classes $indent = ( $depth > 0 ? str_repeat( “\t”, $depth ) : ” ); // … Read more

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