New answers tagged

0

Each of the files you have mentioned are theme files. When you upgrade WordPress itself, it will not touch any themes (or plugins) you have installed, whether or not you have modified them. If this was a theme you created yourself, then you have no worries at all. However, if this was a theme created by someone else, for example a WordPress default theme, ...


1

You will need to store the field value in a variable and use the get_field() instead of the_field() function. From there you can introduce your own custom control structure to set the color you want. Here is a snippet <?php //store the value in a variable first $option = get_field("status"); if($option=="K dispozicii"){ ?> <...


1

The following is not a solution to just insert into a regular WooCommerce catalog page. However, this would easily serve as a basis for someone trying to achieve that. Background: I'm building an Angular/JS app to load on the archive-product page, which will handle everything including the cart until a user is ready to proceed to checkout... at which point ...


0

The most obvious approach to this would be to first create a special user role for your students. Then for users with this role you can expand the profile with extra fields. Here you can store for every user which courses they follow. Next you define a custom post type that allows you to store the video labelled with the courses for which it is meant. ...


2

<?php /* Plugin Name: Custom output Description: A module to test the custom output. To test: http://your_wordpress_site.com/customop_uri_path Version: 1.0 Author: Danilo Silva Author URI: http://danilocgsilva.me */ // Write a new permalink entry on code activation register_activation_hook( __FILE__, 'customop_activation' ); function customop_activation()...


0

You need an action called manage_$post_type_posts_custom_column. This will allow you to add columns to your custom posts page. To be more precise, you need a filter to generate the column and an action to fill it with content. In your case something like this (untested): add_filter( 'manage_chimpmunks_posts_columns', 'set_custom_size_column' ); add_action( '...


0

You can use the body's classes : body.single-artist #main{ background-color:red; }


0

Collapse the <div id="main">. I hope that you have <article> tag which id and class attributes like below <article id="post-212" class="post-212 post type-post status-publish format-video has-post-thumbnail hentry category-resources post_format-post-format-video active"> Inside the class attribute you can find the post type as type-post, ...


0

From my point of view you are trying to make a pagination on a page, which can also mean wordpress is trashing your page/paged var, this can be easily solved by adding a filter adding a custom vars page/paged add_filter('query_vars', function( $vars ){ //!!SUPER IMPORTANT!! - always *APPEND* $vars array (NOT re-assign) $vars[] = 'page'; $vars[] ...


1

If you hook into the hooks provided in update_post_meta() function and still use this function in your callback, that would result in a loop which would probably end with the timeout.. As the per the comments: add_action("wp_insert_post", function( $post_ID ) { if ( ! $post_data = get_post( $post_ID ) ) return; // try to make this run only once ...


7

As @tom-j-nowell said in comment to OP, multisite can make this easier. Performance and security are not really a problem for multisite (at least, not more than they are for regular installations), but I do agree that multisite can sometimes be a problem, because a lot of plugins (either custom or 3rd party) may not work properly on multisite, or maybe ...


0

There is a lot of nuance here, depending on what exactly you want to accomplish. I don't feel confident I completely grasp it from your question. In general WP logic flow is following: URL is converted to query vars query vars go into main query instance main query instance queries posts template loader uses conditional tags (which use main query) to ...


2

That edit explains it. Alphabet is poorly written. Its use of php's include rather than WordPress's own include functions like get_header and get_template_part is breaking the parent/child hierarchy. You could probably make a copy of the file header.php and change those includes, as long as the file calling in header.php does it correctly! As long as ...


2

The dynamic filter "term_{$field}" is probably what you're looking for, where the field is "name." One approach is to have an array of names and their pseudonyms, then do a check-and-return on them so they'll display the replacement. add_filter( 'term_name', function( $value ) { $terms = [ 'old' => 'new', ]; // basic example check, ...


0

I found this approach to solve the problem of validate metabox fields using PHP code https://tommcfarlin.com/post-meta-data-error-messages/ Hope this help you (works for me in a similar scenario)


0

Here is what I have in my own .htaccess file that does what you're looking for: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On Options +FollowSymLinks RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^example.html$ /wp-content/raw/example.html [L] RewriteRule ^download$ /wp-content/raw/download-ebook.html [L] RewriteRule ^thanks$ /...


0

In wordpress a translation is part of the code. If you change translations you should track the .po files in "git" as if it was any other kind of code. An alternative option is to override the textdomain used for translation and use another one that uses another .mo file located at some "safe" location. But this is just a band-aid over the "translation is ...


0

Gallery Image Captions - Hide/Show I just recalled this caption toggle question, when I was writing this answer, so let me rewrite it a little bit to work for this question. Let's introduce the caption_toggle attribute for the native gallery shortcode, that takes a comma separated string of bool values. It's possible to hide the captions with CSS, but ...


3

After digging around, I ended up with using upload_dir filter. Here is what I tried in functions.php to change uploads to media. Hope it can help someone too :) add_filter('upload_dir', function($uploads) { $custom = []; foreach ($uploads as $key => $value) { if ( false !== strpos($value, '/app/uploads') ) { $custom[$...


0

i solved with this code placed in functions.php function my_admin_notice(){ echo '<div class="updated"> <p>message here!</p> </div>'; } add_action('admin_notices', 'my_admin_notice');


2

If you look at the source of _wp_upload_dir, you'll see: if (defined('UPLOADS') && ! (is_multisite() && get_site_option('ms_files_rewriting'))) { $dir = ABSPATH.UPLOADS; $url = trailingslashit($siteurl).UPLOADS; } So UPLOADS can only be used to define a foder relative to ABSPATH, which I guess is /WordPress folder in your setup. ...


0

To show it above the title you can do this. Add the following to your functions.php and make a js file of the same name in your theme directory. function admin_js_custom() { $adminjs = get_stylesheet_directory_uri() . '/admin-js.js'; echo '"<script type="text/javascript" src="'. $adminjs . '"></script>"'; } add_action('admin_footer', '...


0

You can do this by hooking into the edit-post.php page. There are a variety of hooks you could use, for example, if you want to display a message below the edit title field, you could hook into edit_form_after_title. See the example code I have below with comments: add_action( 'edit_form_after_title', // the hook 'wpse_228208' // the function ); ...


1

You're using the reserved public query variable name as your custom one. It can e.g. affect the canonical redirect by setting page_id and name for a different page. Change it to something else to avoid possible name collision, like kenan_video_slug: add_rewrite_rule( '^watch/([^/]*)$', 'index.php?pagename=watch&kenan_video_slug=$matches[1]', ...


0

Static pages: Valid? Yes. You absolutely can add static pages that have nothing to do with a blog aside from using WordPress "routing" API out of the box and the database. Styles, Script: How? Simply add your custom styles and scripts to your theme. Then register and enqueue them. You can add your own Page Templates. Since WP 3.4 the actual page template ...



Top 50 recent answers are included