Tag Info

New answers tagged

0

You can look here for some solution. add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');


0

You do this with URL Rewriting. Locate your .htaccess file and add this line above # BEGIN WordPress RewriteEngine On RewriteRule ^author/(.*)$ /team/$1 [R=301,NC,L] Note, if you put this inside the wordpress block it will get rewritten next time your permalinks are regenerated.


0

Their archives will use archive-{post_type}.php 'has_archive' => true, has_archive (boolean or string) (optional) Enables post type archives. Will use $post_type as archive slug by default. Default: false


2

If you output the description with bloginfo(), you can use the filter bloginfo. add_filter( 'bloginfo', 'wpse183972_description_italic', 10, 2 ); function wpse183972_description_italic( $text, $show ) { if ('description' == $show) { $word = 'WordPress'; $text = preg_replace( '^(' . preg_quote( $word ) . ')^', '<em>$1</em>', ...


1

I packed everything together. Consider using wp_enqueue_script() to use the script. With this code, you will save all URLs as an array. See how I use get_post_meta() to retrieve the saved URLs. function save_custom_metabox($post_id){ if(!isset($_POST['source_post_metabox_nonce'])) : return; endif; if(!wp_verify_nonce( ...


0

Here you can read an article about how to deal with. You'll have some mandatory things to do such rewrite your taxonomy with the same name of the custom post type. http://someweblog.com/wordpress-custom-taxonomy-with-same-slug-as-custom-post-type/


1

<?php // Display Custom Field Value echo "<ul>"; echo "<li>License Type: ".get_post_meta( $post->ID, 'License Type', true )."</li>"; echo '<li><a href="' . get_post_meta( $post->ID, 'Download Comp', true ) . '">Download Comp</a></li>'; echo "</ul>"; ?>


0

There are quite a number of ways to achieve this and to optimize this to make it efficient as well. Here is just a basic idea to achieve this by using the offset parameter in WP_Query and using the php function date() to get the current week number. First, you should get the current week number with date( 'W' ). You can decide to take this as your ...


0

As Peter mentioned, Jetpack Stats would be a neat way to handle this. It has its own Popular Posts widget which you can take as a starting point, the API is fairly simple. An alternative is the Google Analytics API. I wrote a tutorial about this quite a while ago, it's probably somewhat outdated, but it can be a good reference at what you should be looking ...


0

You can try Jetpack by Wordpress Plugin It can display list of most viewed posts in the sidebar of last 24 hours Also it has detailed stats page


0

That is pretty easy to do with WP's login_redirect filter. A small snippet like this added to your functions.php file would do it: /** * Return the url you want to redirect to after login. * This example redirects the user to the main page. */ add_filter( 'login_redirect', 'my_login_redirect' ); function my_login_redirect( $redirect_to ) { return ...


1

It depends on the theme. Most themes provide a composer (like Visual Composer) to adjust page content. If your theme doesn't work with a composer, you have to change the server files. Take a look at the child theme workaround then.


0

If you have done the first part correctly in loop-home.php, you can just simply move that into the appropriate template used by your archive pages. Taken into account that you have not used custom queries to build your queries on the homepage or any of the archive pages, you can do the following which will work on any of the aforementioned pages Use the ...


0

There are many options, but these functions are your friends: wp_insert_post - pass it some arguments and it will create a post and if succesful, return the post ID wp_set_object_terms - pass it a post ID, a custom taxonomy, and the terms you'd like to set fopen - for opening a csv file fgetcsv - reads in a single line from a csv and returns it for ...


0

You should really re-title this question and refine your question further. From what I gather you are actually trying to find out how to add posts to your custom post type that has custom fields via a CSV. My suggestion is to look for a plugin that imports posts from a CSV and either find one that already has a column for post_type and columns for custom ...


0

I was able to resolve this issue without using a separate theme or subdomain. I have elements of my theme that are loaded/not loaded on the server side based on the user agent (mobile/not mobile). After installing and enabling some basic caching with W3 Total Cache, I was getting desktop elements on mobile or vice versa. In W3 Total Cache User Agent Groups ...


0

I don't want to repeat the coding options since they have been exhaustively covered, the other option I know that works is using a plugin that hides wp. I have used this plugin before to satisfactory standards. Its called hide my WordPress.


0

The problem lies in your soto_user_meta_box_save function. This function is tied to the save_post action, which means it will fire whenever any post of any post type is saved, not just your custom post type. You need to add a check inside this function so it aborts when testing the wrong post type: function soto_user_meta_box_save( $post_id ) { // ...


0

If you're using Yoast's SEO plugin, you can set a default image for Facebook shares from the WordPress backend.


2

As you have already understated, running executable PHP inside a text box is not a good idea. It isn't only just not a good idea, but a terrible idea. This creates a loop hole in your security which can be very easily exploited by a hacker. I would suggest writing your own custom widget for this functionality. It is really easy adding a custom sidebar to ...


1

The PHP Code Widget does not modify the Text or Visual editor box, or the standard "Text" widget; it adds a "PHP Code" widget, which you'll find under Appearance > Widgets > Available Widgets. If you want to display your script within the body of the post or page, you should create a Shortcode. The basic example from the API would work for "Hello World"; ...


3

You can use is_paged() ...checks if page being displayed is "paged" and the current page number is greater than one. This is a boolean function, meaning it returns either TRUE or FALSE. You can adjust your code as follows <?php if( is_home() && !is_paged() ) : ?> <p>Some text</p> <?php endif;?>


1

You could do this with jquery. I have a similar code on use which you could probably easily edit to your needs: load the admin js (I load css too but you can remove that) function wpse181868_admin_css_js() { wp_register_style( 'bones_admin_css', get_template_directory_uri() . '/library/css/admin.css', false ); wp_enqueue_style( 'bones_admin_css' ...


0

If I understood correctly you need to show a specific category index on a page template, right? If that's the case you can use WP_Query: <?php /* Template Name: My Page Template */ ?> <?php get_header(); ?> <!-- If you want to retrieve the page title, content, ... --> <?php the_post(); // set up the post ?> <h1> ...


0

You have two options. Either use get_field or the_field. get_field just reads out the field from the db without and screenoutput. like you did in your first line: $fields = get_field('testimonial'); the_field instead is get_field with an implied echo. <?php the_field('testimonial'); ?> so basically the_field would be enough. Aside you have to ...



Top 50 recent answers are included