Add/echo div with Analytics-Code to function in functions.php

echo (‘<div onClick=”ga(‘send’, ‘event’, ‘will-ich-haben’, ‘klick’, ‘test-klick’);”>’); I haven’t looked any further but as a first step, this string isn’t concatenated correctly. echo “<div onClick=’ga(‘send’, ‘event’, ‘will-ich-haben’, ‘klick’, ‘test-klick’)’></div>”;

Upload images and attachments from frontend form

I mentioned in a comment how it’s important to debug your code. Here’s why: The images are added first. In the image adding section, you’re running this line of code: $_FILES = array(“moreimages” => $image); Then when you get to your routine that adds the files, you start with this: $files = $_FILES[‘morefiles’]; Can you … Read more

How to use a frontend URL with a Plugin

Must exist a real page in WordPres? Yes, you need to create a page, but it doesn’t have to have any content. Let’s say you created a new page named ‘Confirmation message’. The URL would be http://example.com/confirmation-message. Now add the following to the functions.php of your theme: /** * Adds a confirmation message to the … Read more

How do I add a php statement to a jQuery string

You might want to try to use wp_localize_script() to allow your javascript to use data that are normally only available using php. Here is the link in the codex that will help you do what you need: https://codex.wordpress.org/Function_Reference/wp_localize_script Another way is to use a php to output your entire javascript code (in a php file, … Read more

How to protect own PHP code from WordPress updates

NEVER EVER alter any template or file in a theme or plugin that you did not author, and this goes for any core file as well. There is no way to protect the code that you alter or add in any of those files, except maybe changing file permissions, but then again, you will run … Read more

I want to remove the links from the term list returned by get_the_term_list

You could use get_the_terms() and wp_sprintf_l(): function wpse_52878_term_list( $args = array() ) { $default = array ( ‘id’ => get_the_ID(), ‘taxonomy’ => ‘post_tag’, ‘before’ => ”, ‘after’ => ”, ); $options = array_merge( $default, $args ); $terms = get_the_terms( $options[‘id’], $options[‘taxonomy’] ); $list = array(); foreach ( $terms as $term ) { $list[] = $term->name; … Read more