Tag Info

New answers tagged

0

This doesn't have anything to do with WordPress or your user's passwords. What it means is that your MySQL server is still using the old-password-hash mechanism, which was changed in MySQL 4.1. The PHP mysqli client is newer and doesn't support the old password mechanism. Since this causes an error, WordPress falls back to the old mysql client, which does ...


1

parent : Comments can be replies to other comments. Every comment has an ID number. When the comment is a reply, then it will have a "parent" which is the ID of the comment it is replying to. Putting a comment ID in here will get all the replies to that comment. post_parent : Posts can be children of other posts as well. This is how things like hierarchical ...


0

You have the browse button and the import button in two different HTML form elements. Don't do that, put them in the same <form>.


0

<?php add_action('admin_menu', 'wie_register_submenu_page'); function wie_register_submenu_page() { add_submenu_page( 'wck-page', 'Import-Export Options', 'Import-Export Options', 'manage_options', 'wie-import-export', 'wie_submenu_page_callback' ); } function wie_submenu_page_callback() { if( ! isset( $_POST['export'] )) { echo ''; ...


-1

Why not just use Gravity Forms with ACF. It does exactly what you're suggesting -- and I've used it a number of times on client sites with great success.


0

If all you do is update ACF fields with your form, why not use the built-in function to generate the form? Create a new ACF field for the images, or simply use the Gallery field type, then display the form using acf_form: <?php acf_form(array( 'post_id' => 'new_post', 'new_post' => array( 'post_type' => 'vendre', ...


1

Please refer below : function disable_new_posts() { // Hide sidebar link global $submenu; unset($submenu['edit.php?post_type=CUSTOM_POST_TYPE'][10]); // Hide link on listing page if (isset($_GET['post_type']) && $_GET['post_type'] == 'CUSTOM_POST_TYPE') { echo '<style type="text/css"> #favorite-actions, .add-new-h2, .tablenav { ...


-1

Okay, so here is the complete query for displaying popular posts of current week. I am using meta_query to limit query results within current week only. It will get all posts from current week and then sort them by post views count added by custom field wpb_post_views_count that you used in your question. // Current week's popular posts $query_args = ...


0

How accurate does it have to be? You'll need to do some kind of incriment counter, and some kind of cleanup function. To be 100%, you will have to keep 7 data points for each post if you want it to be accurate. Keep an 8th (the computed sum), for efficiency. Then your cleanup function should drop the last data point and recalculate the sum once a day. You ...


1

PHP isn't a permanently-running process: it only runs when requested. So as far as I can tell, Wordpress can only update itself when someone loads a web page. But the update process is not instantaneous, so surely a user visiting the site would have a really slow page load. Is there a different trick they use for automatic updates? I've ...


0

You should take a look at the WordPress hierarchy page in the documentation. Here it's the relevant part: page-{slug}.php - If the page slug is recent-news, WordPress will look to use page-recent-news.php http://codex.wordpress.org/Template_Hierarchy


0

Short, a new database table would be an absolute overkill. I think, what you want to do is pretty much resembling the existing menu_order column in wp_posts. Using post meta is just fine, but add it on the the singular staff member posts from your custom post type. So you will have several custom order metas saved for them. And then retrieve the posts ...


0

I think that if you make your choices list a value=>label list, this should work: http://wordpress.stackexchange.com/a/11454/20807 Instead of your current list, 1 : Ultimate Plus 2 : Ultimate 3 : Professional 4 : Commercial 5 : Business 6 : Free It can also be in the order that you currently have 6 : Free 5 : Business 4 : Commercial 3 : Professional 2 : ...


1

You can use get_field from ACF to check if the field is available and according to the documentation how you conditionally check if a field has contents. <div class="wrapper"> <?php if (get_field('discount')) { ?> <p>Discount: <?php the_field('discount'); ?></p> <?php } else { ?> <p>Price: ...


0

It's not related to WordPress, but basic PHP understanding. But I'm answering to provide you the hint. You're doing the thing. Just embrace the whole div with the conditional: <?php $image = get_field('headOfDepartment_pic'); ?> <?php if( $image ) : ?> <div> <img src="<?php echo $image['url']; ?>" alt="<?php echo ...


0

Products are Custom Post Types, so you can find it in wp_posts.post_type='product' || 'product_variation', etc.


1

To get all rows, don't specify the key. Try this: $meta_values = get_post_meta( get_the_ID() ); var_dump( $meta_values ); // so you can see the structure


1

I found the solution from a Wordpress forum and this is what they used. Works perfect <?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' ); $image = $image[0]; ?> <?php else : $image = get_bloginfo('stylesheet_directory') . ...


0

Your question is pretty vague and you haven't given any example code, but the following may work for you: <?php global $post; // Arguments $args = array(' /* Enter your arguments in here... */ '); // The query $the_query = new WP_Query( $args ); // The loop if ( $the_query->have_posts() ) { // ...


3

You don't necessarily need to use the WP Cron API for this. Instead you could modify your existing code to make use of WP Transients. Transients are basically Options that expire after a set time. You can wrap your current scrape process in an if statement that checks for the existence of the stored transient. If it exists, it pulls the data from the ...


1

You can use wp_schedule_event() to fire your price update function at set intervals!


2

I believe the AngularJS plugin has solved this problem by filtering the content with the_content1 filter. They are using post meta to determine when the content should be loaded client side, but you can write your own function to determine when this is appropriate. This way the content is filtered instead of creating a new $post object. Here is an example ...


1

Completely untested but I just threw this together: $post_data = array ( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => $author_id, 'post_name' => $slug, 'post_title' => $title, 'post_status' => 'publish', 'post_type' => ...


0

You can use get_post_status(ID) to check to see if the post is published. You'll need to pull the post ID (through WP Query/loop/etc) if (get_post_status( $ID ) == "publish"){ #Show Published Button } else { #Show Not Published Button } Get Post Status in the Codex


2

SIDENOTE: This function can be used even if have posts belongs to one taxonomy only. You don't need to have a post that belongs to two or more taxonomies within the same hierarchy. I have made this function very flexible It is always a problem for me to display a category list or term list for a post if the following conditions occur Having a post having ...


0

The functions you have tried are for terms by themselves, just existing in site. What you are looking for is get_the_terms(), which retrieves terms of specific taxonomy, assigned to specific post.


0

I was able to achieve the desired effect by using <?php if( checked($property['active'], true, false ) ): ?> ---code to be output--- <?php endif; ?> This gave me the output of just posts that had active checked in their post type. For the record, $property is the custom post type specific to the plugin. "True" is the value to check against ...


1

You could also create a template tag like what the Twenty Fourteen default theme includes rather than hard code it into the single file. if ( ! function_exists( 'twentyfourteen_post_nav' ) ) : function twentyfourteen_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( ...


2

You will need to add %link to the first parameter ($format) of next_post_link and previous_post_link This will generate the html links to the respective posts EDIT 1 Just on your statement about custom queries, did you had a look at how pre_get_posts can be used to alter the main query as needed. It is never a good idea replacing the main query with a ...


0

The reason your custom fields are only showing up when there is post content is due to this line: <?php if( get_the_content() ):?><h3> Everything after that line will only appear if get_the_content() returns something truthy. The reason being that you're using a shorthand if statement and not closing to before the custom field logic Try this: ...


2

First, both of these things (updates and sane file permissions) are neither "OR" choice or optional. That is what you just do, because if you don't sooner or later (even if significantly later) you are going to have problems because of it. Relatively I would say updates are more important, because faulty file permissions tend to harm when in already ...


0

After a little more research, I found out that WordPress stores values such as custom-header and custom-background against the meta key. I guess it's a way to distinguish them from the rest of the attachments in the system.


0

It sounds like what you really might want is a transient. WP Transients are a way to cache the results of a query, and set an expiration date on that cache. So you could cache the results of your example from above for 24 hours. If anyone requests that data while the cache is still valid, it just returns the results without recalculating. If someone ...


0

There is likely no "cp_job" column like you are thinking. extra data/information about a wordpress post type (it looks like ads is a custom post type here) would be stored as post meta in the database. So you might see something in the wp_post_meta table like: meta_id | post_id | meta_key | meta_value XX | XX | _cp_ad_type | buyer Once you know the name ...


1

Looking at your function: function my_task_function() { $test_score update_field('score', $test_score ); } $test_score is not defined here, it should be $test_score = 'something'; Left the way you have it now will generate php warnings. Also the update_field function used in this context (in a cron) will require you to pass a third argument ...


0

The print() output string into current page view. But in the case of the WP cron you never see that page view. It is executed asynchronously and is never sent to your browser. You should be monitoring if it runs in some other way, for example writing a log to a file or saving something like "Last time run was..." to an option.


1

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


0

Again, I'm not familiar with Advanced Custom Fields but you may be able to store the returned value into a variable then test if that variable is empty, like so: <?php $pista1a = types_render_field("pista-1a", array("argument1"=>"value1","argument2"=>"value2","argument2"=>"value2")); ?> <ul> <?php if( ! empty( $pista1a ) ) : ...


1

http://php.net/manual/en/function.preg-replace.php preg_replace expects your first parameter to be a pattern. Try a simple replace: $item = str_replace( array('.',' '), array('-','-'), strtolower($item));


0

As you're using a VPS with SSH access, give WP-CLI a try http://wp-cli.org/ can work wonderfully http://centminmod.com/nginx_configure_wordpress_ffpc_plugin.html#installwp for example to install limit login attempts plugin just run this command from SSH within your wordpress install directory wp plugin install limit-login-attempts --activate --allow-root ...


0

anybody that looking for solution here is what i found that work for me. to get some data from any field in profile page you need to use this function: <?php get_the_author_meta( $field, $userID ); ?> then if you want to update some value in theme customizer you can use this function: set_theme_mod( 'field name', '$value' );


4

I guess you mean something like this: if( function_exists( 'get_post_random_wpse' ) ) echo get_post_random_wpse( $post_id = get_the_ID(), $meta_key = '_post_random', $meta_value = rand( 1000, 10000 ) ); where: function get_post_random_wpse( $post_id = 0, $meta_key = '_post_random', $meta_value = 0 ) { if( ! ( ...


1

One alternative offered to the above answer is to add a column (meta key) with meta values which can easily be sorted with 'orderby' => 'meta_value' in the args. Here is a function I wrote to add the meta values to each user. I'm including it here because $my_order_ids = array( 3, 4, 6, 2, 5 ); determines the ascending order users should be sorted by ...


0

I fixed it by: 1) checking wordpress version in: /home/myusername/public_html/version.php 2) downloading this version package from wordpress website 3) addingwp-includes/session.php file from downloaded package into /home/myusername/public_html/wp-includes/session.php (that file was empty or not existing)


0

Your NO TITLE page is calling function get_template_part( 'content', 'page' ); Which means its calling page 'content-page.php' I won't recommended to edit this page directly as it might be used at other places in theme. Solution: Copy content-page.php and name it content-notitle.php The remove title from new copied page. Now you can call this ...


-1

Inside your get_template_part() you can find the_title() function that prints page title. Simple comment it out or delete it, but never, NEVER use display:none with CSS.


0

It's simple: Don't forget to move add_filter to functions.php file :) <?php /* Template Name: No Title Page */ add_filter( 'the_title', function ($title) { return "";}); ?> <?php get_header(); ?> <div class="wrapper"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> ...


-3

Page title can be used in the following code: <?php the_title( '<h1 class="title-header">', '</h1>' ); ?> If you'd like to hide it use you can hide it with CSS or comment it out. CSS: h1.title-header{ display: none; } Hiding the element with CSS search engines read the page title even though it doesn't appear on the page.


2

What you are asking for is called "upscaling images". Wordpress does not do that by default (with reasons). 2 solutions: no physical upscaling: display your images via CSS (and not as IMG html tags), using background-size: cover; a plugin that upscale images. Here is one (untested).


4

I wonder if this works for you: add_action( 'pre_user_query', 'wpse_order_by_include_values' ) $query = new WP_User_Query( $args ); remove_action( 'pre_user_query', 'wpse_order_by_include_values' ) where function wpse_order_by_include_values( $q ) { if( isset( $q->query_vars['include'] ) ) { $values = join( ',', ...



Top 50 recent answers are included