Tag Info

New answers tagged

0

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 ...


1

Here is the procedure to properly migrate a Wordpress Multisite. Step 1 – Move Database and Files The first step is to open your FTP client and upload the files from your computer to the server. Next, on your server set up your database and user, and use phpMyAdmin to import all the database tables. If you visit your site now it won’t work, you’ve got ...


1

If you are talking about the wp-admin dashboard, then, the editor will be inside Appearance > Editor. The $12 you are paying looks like just the domain name fee. For safely editing the php files, you need ftp or sftp access. You need to contact the Tumblr support team for this issue.


1

For anyone still interested in customizer export/import functionality, we just released a new plugin on the wordpress.org repo that does exactly that! https://wordpress.org/plugins/customizer-export-import/ Don’t hesitate to let us know what you think!


0

You can do something like this inside your functions.php: add_action( 'wp_head', 'dynamic_layout' ); function dynamic_layout() { echo '<style type="text/css">'; if ( is_active_sidebar( 'secondary' ) && is_active_sidebar( 'main' ) ) {//If both sidebars are active ?> #blog { width: 100%; } <?php } // End If both sidebars are active ...


0

You can use is_active_sidebar() as a condition to enqueue your styles. It does precisely that — tells you if it has any widgets assigned. PS stop function_exists() madness :) that is completely pointless check in modern WordPress.


0

You can't directly use sendTrailer.php ,wordpress can't find this custom page directly so you have to specify fully path of that page using get_template_directory() In your ajax function write url : '<?php echo get_template_directory(); ?>/sendTrailer.php'


2

Per comments, it's called with call_user_func_array, so the 1st 2 elements get assigned to the declared arguments $elements and $max_depth, leaving the third element ($r which is the original $args) to be assigned via array_slice to $args. Eg function wpse172812( $elements, $max_depth ) { $args = array_slice(func_get_args(), 2); ...


4

$wpdb->prepare() supports a small subset of the sprintf() arguments. The %d is a placeholder for an integer (not a decimal, that would be %f). Use %d when you want to send a real integer to the database, use %s for strings. An example: $post_id = '2'; $prepared = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_id = %d", $post_id ...


0

Its Very simple you can implement like this ${variable_name}.another_varibale; For Example for($i=1;$i<10; $i++) { ${total}.$i = 10+$i; } for(j=1;j<10;j++ { echo ${total}.$i; }


2

If your code uses wp_mail function to send emails, then you can specify multiple recipients using an array or a comma-separated string. So your $emailTo will be.. $emailTo = array( 'ponim@orot.ac.il', 'email1@example.com', 'email2@example.com', ); If your code does not use wp_mail function then you can define multiple instance of PHP mail ...


0

You can get same result by outputting values from PHP array. Since it is multicolumn array, you will need to run foreach loop and get values of each child item. Mostly it's standard PHP stuff, nothing special. Although earlier you did not need to supply post ID in each WordPress function since you were using it inside a loop, but now you will have to do ...


2

Basic how and why Extending on my blog post about that topic: When you enter a password into a form built by get_the_password_form(), the form targets ~/wp-login.php with a query argument named postpass which is the $action the login file uses to switch. There the PasswordHash class gets into use and a cookie gets set [...] When does it happen? The ...


0

Try reversing the condition : if(post_password_required( )): echo get_the_password_form(); else: // if password not required or password cookie is present // your protected content here endif; See codex Hope that helps.


2

The problem with your code is that it is hard to read and you don’t see clearly what the real goal is. Always start with the desired minimal result, then make it more flexible, but keep the logic for that separate. All you need is a <div class="entry-content">, maybe with a style attribute. So start with that: <div class="entry-content" <?php ...


2

you get this error if you passed empty string or did not pass any argument to the __() function. You should check where you've used the __() function and check what value is being passed as argument.


1

All of the code in your question can be replaced with: require_once( ABSPATH . 'wp-admin/includes/image.php' ); require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/media.php' ); if ( $_FILES ) { foreach ($_FILES as $file => $array) { $image_post_id = media_handler_upload( $file ); if ( is_wp_error( ...


1

Short Term Solution As per the answer at: http://stackoverflow.com/a/9984309/1983389 you can suppress the warning messages via changes to your php.ini or .htaccess file. In your php.ini change error_reporting = E_ALL to error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT If you don't have access to the php.ini, you can ...


2

You're WordPress install is out of date. Upgrading to the latest version ( 4.0.1 at time of writing ) should fix those issues, while fixing hundreds of other bugs and security issues. As a side note, you should always keep both your PHP and WordPress installs at the latest versions. Select PHP 5.4, and move to 5.5 and 5.6 as they become available. They fix ...


0

What version of WordPress? It's late and I'm tired but basically, the code is out of date. The site must be ancient. 5.2 was released in 2006 and 5.3 in 2009. As the only variable that's changed is the PHP version, I'm confident it's that. Time for a rewrite perhaps.


0

If you have a page, and need to run PHP code that isn't in your standard page template, you can: Use a custom page template Create a template with page-pagename.php Implement and use a shortcode All three are valid and suitable methods for doing this, however, do not: Try to let users place actual PHP code in the post content ( MASSIVE security risk ) ...


0

You don't need to change the core file. They're classes which means they can be extended. It'll require a bit of leg work but all you need to do is load an instance of the class and then extend/add to it. That's the beauty of OOP.That's if there isn't a hook to modify things with already, which there probably will be.


0

You should never modify WordPress Core. The people who recommend you do this are mistaken. The reason for this is that when you update WordPress you loose all of your changes. It also means assumptions plugins make about how Core work can be broken by your changes. Instead, if you need to change Core behaviour, remove things, add things, or modify them, you ...


0

Here is an idea. Note, this will only work if all posts are in the desired category and if all posts have only category The posts are returned in an array which you can access through $currentissue->posts With this in mind, you can get the first post ID as follows $currentissue->posts[0]->ID Now, you can add that to a variable $id = ...


0

All you need to do is pass the field you want to order by in your SQL: ORDER BY post_id DESC This example will get the post_ids out with the highest first e.g. 99, 98, 97 OR ORDER BY post_id ASC will do it: 1, 2, 3 and so on. Alternativly if you want to group the results by the meta_value: GROUP BY meta_value


0

To add to Bainternet (I am adding this as an answer because I cannot comment -- I have less than 50 points on WP Development stack). WordPress will only store a timezone string if you select a timezone string in the general settings. UTF selection is where it defaults in the list, but you can scroll way up to timezone strings. If you set a timezone ...


0

This is a super annoying error message as it could be many things, and it doesn't reveal the actual error (which is often silenced in other parts of the code). This error appears when the wp_mail() function returns false, which in turn could happen if phpmailer->Send() returns false or raises an exception. How to display warnings from PHP's mail() ...


0

I was able to keep the $postCount variable counting by starting a php session in my functions.php file function init_session() { session_start(); } add_action( 'init', 'init_session', 1 ); ...and setting up my loop like so: [...] <body> <div class="posts"> <?php $postCount = 0; if ( is_paged() ) : ...


1

WP_Query has a $post_count variable. http://codex.wordpress.org/Class_Reference/WP_Query#Properties Just pass that with the script using wp_localize_script


0

In case someone finds this someday I was able to solve this and I used tis walker: class Navigation_Catwalker extends Walker_Category { // Configure the start of each level function start_lvl(&$output, $depth = 0, $args = array()) { $output .= ""; } // Configure the end of each level function end_lvl(&$output, $depth = 0, $args = array()) { ...


2

You should use do_shortcode() function in both strings you are returning it will execute the shortcodes in the string. function oldStuff(){ return do_shortcode(' [new] only raw html is in this function '); } add_shortcode('old', 'oldStuff');


0

Just move your wordpress installation to a subdirectory and switch back after. See the Wordpress Documentation.


0

I believe that it will be hard for you to accomplish that without some javascript because you are adding the link manually. However, you can achieve the same thing in another way: Most wordpress themes come with a body_class() function in the <body> tag. That function adds several classes to the body tag that allows you to better target your content ...


0

You can install this plugin, Debug Bar, it is not only query, you can also debug more information.


0

A good pointer would be to enable debugging in WordPress. Add this to your wp-config.php: define( 'WP_DEBUG', true );. By default WordPress does not show much debug information. More on this here.


-2

the simple and easy way to do this in php. example here: dont forget the html tags(this form wont allow it here so i use [this]) $firstname = $post[firstname] $lastname = $post[lastname] [form action="here.php" method="post"] first name[input type='firstname' name='firstname'] last name[input type='text' name='lastname'] [input type=submit ...


0

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. ...


0

Yes I can visit it by firefox. Not the links are overlapping. As there is nothing in the image link "http://cmscard.com/files/wpsc/product_images/thumbnails/about2.jpg". The text between "alt" is overlapping. Make sure that the image link is perfect. Else shorten/delete the text between "alt" tag. For editing style.css: wp-content > themes > theme name > ...


0

Anything concerning the look of wordpress can be corrected within the theme folder. You can find that here: wp-content-->themes-->theme_name


0

You can set the amount of posts to display in the admin panel under 'Settings > Reading > Blog pages show at most .. posts'. If you want to style this afterwards, more information here: http://codex.wordpress.org/Pagination Or a useful plugin: https://wordpress.org/plugins/wp-paginate/


0

first off; turn the wp_debug function on if you haven't already. (wp_config.php). This should give you some additional error data. Secondly; it looks like you are using urldecode, but not encoding your string. If you're including an email address be sure to urlencode your data as well.


0

Adding this snippet to function.php should do the trick function restrict_mime($mimes) { $mimes = array( 'pdf' => 'application/pdf', ); return $mimes; } add_filter('upload_mimes','restrict_mime'); EDIT Sorry, didn't read carefully, I see you need to be able to upload PDFs, but just hide it from guest users. It will ...


0

Here's a quick example showing how you would pass php data to your script. First, we hook our function to the wp_enqueue_scripts action. Inside, we enqueue the script that contains the player and initialization code (this is probably two separate files, but I've condensed it to a single file in this example). Next, we call wp_localize_script and set some ...


1

Basically, your question is asking "how do I spoof the From header" and the answer is, essentially, that you don't. While email in general has always been very non-secure in that spoofing a From is easy, over the years, lots of solutions have been devised to block emails which have an incorrect from. Those solutions are what is blocking you, and there's no ...


0

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() { ...


1

I don't know which contact form and mailing plugins you are using, but in general you shouldn't configure contact form mails to be conimng from the email address entered. Many E-Mail servers don't accept mail like this. Instead you should properly configure a Reply-To: header with the info entered in the form. If this is done correctly, the recipient of the ...


2

There isn't really such a thing as separate WP memory limit. It's just a WP way with messing with PHP setting, instead of just using... you know... PHP for that. If WP limit is more than PHP limit then WP will attempt to increase PHP limit (which doesn't mean it will succeed at that, but it will try). If WP limit is less (such as in your example) then it ...


0

I also was wondering how to incorporate anchors into my wp_query loop. The above code by Seamus was excellent, however I had to take out the # for the <div id="#post-<?php the_ID(); ?>"> line for it to work properly.


0

Ok, so somehow I got it working by changing it to this: It looks like it didn't like 'the_clientId'. Maybe it just doesn't like capital letters???? [insert-form form_location="form.php" identification_number="12345"] function insert_the_form($atts){ $form_base = plugin_dir_path(__DIR__); // Shortcode attributes & options $atts = shortcode_atts( ...


2

I believe you are looking for is_tax()and not has_term(). has_term() just basically checks if a post belongs to a given term, while is_tax() on the otherhand checks whether or not you are on a taxonomy archive page. So, you can change this code if ( !has_term('juice', 'types' ) ): to if ( !is_tax( 'types', 'juice' ) ): This simply means that if the ...



Top 50 recent answers are included