writing an unique php function to be used on my website

You are returning the translation in your function, not printing it. Using <?php echo date_translation(); ?> should solve the problem. (given that functions.php is initiated at the time you use the function) Edit: In order to follow WordPress convention, you should call the function get_date_translation(). If you want the function to echo the result instead, …

Read more

Creating customized php files in theme folder

Problem#1: You can create a customized php file for your page using a Page Template Page Templates WordPress looks for template files in the following order: Page Template — If the page has a custom template assigned, WordPress looks for that file and, if found, uses it. page-{slug}.php — If no custom template has been …

Read more

limit number of post for achive page

You should use the pre_get_posts filter for this. For example, you could do this in your theme’s functions.php file: function limit_category_posts( $query ) { if ( $query->is_archive() ) { // Do not do this for the date or category archives. if ( $query->is_date() || $query->is_category() ) return $query; if ( $query->query_vars[‘cat’] == 8 ) { …

Read more

Adding attribute to the post.php form tag in wp-admin

The form is generated in file wp-admin/edit-form-advanced.php. The relevant code starts at line 410 (WP version 4.0.1). Inside the <form> tag an action is fired: <?php do_action( ‘post_edit_form_tag’, $post ); ?> so it should be easy to use this action by hooking some small function to it from functions.php: function post_form_novaidate() { echo ‘ novalidate=”novalidate” …

Read more

How to edit wordpress pages through cpanel? [closed]

your provided link there is mistake in your uploaded product images.There is no image in all post/product that’s why links are overlapping. For that whenever you add this all posts/product into wp-admin at that place please select or upload appropriate images or remove this tag from the specific file. file location is below. wp-content->themes->your-theme->content.php or …

Read more

add the value of a variable returned in a while loop [closed]

Try to change with this: …….. …….. …….. $fullcost = 0; while( $connected->have_posts() ) : $connected->the_post(); $cost = get_post_meta( $post->ID, ‘foxware-ingredient-cost’, true ); $fullcost += $cost; echo ‘<li>’; the_title(); // Display cost echo ‘<br>’; echo ‘Cost: ‘ . $cost; echo ‘</li>’; endwhile; echo $fullcost; ?>