Add multiple JavaScript files to template header [duplicate]

You can’t have <script> elements within your PHP like that. Either take them out of the PHP delimiters (<?php ?>) or use wp_register_script() and wp_enqueue_script() to get your scripts within WordPress. Update how can i use wp_enqueue_script() with multiple scripts ? wp_register_script( ‘jquery-1.8.2’, get_template_directory_uri() . “https://wordpress.stackexchange.com/scripts/jquery-1.8.2.min.js” ); wp_register_script( ‘contact’, get_template_directory_uri() . ‘/scripts/contact.js’ ); wp_register_script( ‘easing-1.3’, … Read more

Custom Meta Box If Else Statement

You can try this: <?php // get image source: $metaboxtext3 = esc_attr( get_post_meta( get_the_ID(), ‘my_meta_box_text3’, true ) ); // get link: $metaboxtext4 = esc_attr( get_post_meta( get_the_ID(), ‘my_meta_box_text4’, true ) ); // check if the image source exists: if(strlen($metaboxtext3)>0){ ?> <a href=”https://wordpress.stackexchange.com/questions/84788/<?php echo $metaboxtext4; ?>”><img src=”<?php echo $metaboxtext3; ?>” alt=”” onerror=”this.style.display=’none'”/></a> <?php } ?>

Insert dynamic content into posts

Everytime you upload a new image, the afip_new_post_content filter is called which can be used to change the post content before creation – http://wordpress.org/extend/plugins/automatic-featured-image-posts/ Assuming you have a list of URLs stored somewhere – like in the database – you need a function that would get a url from this list, then delete the url … Read more

Display latest 5 posts on homepage

The issue is with your $limit var, you can’t set a default value like that because WordPress overwrites it with an empty value. Check out the Shortcode API for the correct way to pass and set shortcode attributes. function custom_prev_posts( $atts ){ extract( shortcode_atts( array( ‘limit’ => 5 ), $atts ) ); // the rest … Read more

posting twice from an array?

You could try something like this: $postTitle=””; // save post title if(isset( $_POST[‘submit’])){ // if submit button is present $vergoeding=$_POST[‘vergoeding’]; $extrakosten=$_POST[‘extrakosten’]; for ($i=0; $i < count($vergoeding); $i++) { $new_post = array( ‘post_title’ => $postTitle, ‘post_content’ => ‘ ‘, // can not be empty ‘post_status’ => ‘publish’, ‘post_type’ => ‘landschapselement’ // custom post type ); $pid … Read more

Trying to display ads on only a third of posts in a loop. Keep getting Error 500?

echo “<img src=\”” . bloginfo(‘template_url’); . “/img/sample-ad-side.png\” alt=\”Sample Advertisement\”>”; You added a semicolon, what comes after that semicolon is a new statement. . “img/ etc is not valid PHP, so it errors out. Also bloginfo does not return its value, it prints it, so you need to change that to get_bloginfo. I would suggest you … Read more