Apply html elements in php statement

Do this instead: add_post_meta($newpostid, ‘name’, $formdata[‘your-first-name’] . ‘ ‘ . $formdata[‘your-last-name’]); This uses PHP string concatenation to add a space; the echo isn’t necessary in in this instance because WP will do it itself, later. You probably can’t force a non-breaking space there, either, since WP will escape all its output.

select wordpress custom post type

Please check WordPress theme hierarchy and you will know which file you need to create for custom post types 🙂 http://codex.wordpress.org/File:Template_Hierarchy.png Most likely you are after archive-$posttype.php

Accessing Global Vars & Functions in custom php page

Adding the following code to the top of the PHP file will give you access to the WordPress functions and global variables. <?php include_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-load.php’ ); You should then be able to run normal WordPress functions to determine whether or not the user is logged in: <?php global $user_ID; get_currentuserinfo(); if ($user_ID) { // Do Something … Read more

What does $2$3 mean? [closed]

Agree this isn’t really a WordPress question. However, I believe the $1, $2, and $3 refer to the capture groups determined by the (.*?) wildcards. Now, regex is totally voodoo to me so I’m sorry I can’t explain it 100%. However if you look at the $pattern definition: $pattern = ‘/<img(.*?)src=”https://wordpress.stackexchange.com/questions/66610/(.*?).(bmp”gif|jpeg|jpg|png)”(.*?) \/>/i’; Then $1 is … Read more

Categories from front-end, checkbox selection doesn’t work

You changed the checkbox’s name attribute value. You should use the same name value: terms[$taxonomy][] This should fix the code: if (is_taxonomy_hierarchical($taxonomy)) //$out .= “<input class=”{$term->term_taxonomy_id}” type=”checkbox” value=”{$term->term_taxonomy_id}” name=”{$term->term_taxonomy_id}” /> {$term->name}<br />”; $out .= “<input class=”{$term->term_taxonomy_id}” type=”checkbox” value=”{$term->term_taxonomy_id}” name=”terms[{$taxonomy}][]” /> {$term->name}<br />”; else // $out .= “<input class=”{$term->term_taxonomy_id}” type=”checkbox” value=”{$term->name}” name=”{$term->name}” /> {$term->name}”; $out .= … Read more

displaying the categories post

That happens because the_content() contains already an echo. PHP tries to create the string before it sends it to the echo command. While the string is evaluated the content will be printed already. Then echo gets what was not yet printed: the li tags. So the simple fix is: echo ‘<li>’; the_content(); echo ‘</li>’;

Using a string from a custom field within a link

Change, <?php $email ?> to… <?php echo $email; ?> as you need to echo the result of what’s held within $email as the function types_render_field would be using return within the function (if you dig into its core) to return the data instead of directly printing it to screen. <?php $email = types_render_field (“email”); if … Read more