Tag Info

New answers tagged

0

Please try replacing print apply_filters( 'taxonomy-images-queried-term-image', '' ); with print apply_filters( 'taxonomy-images-list-the-terms', '' ); For WordPress default post type, I created category.php template and altered your code as below. It is showing category image. You can view the snippet here


0

You can use get_object_taxonomies() as your solution. Returns all the taxonomies for a post type or post object: <?php get_object_taxonomies( $object, $output ); ?> Have you tried anything? something like this? // taxonomy term archives $post_type = get_post_type(); // find out if CPT $taxonomies = get_object_taxonomies($post_type); // Find ...


0

By default get_post_meta() returns an array. Set the last parameter to true to return the value of the meta data. See the codex as a reference > Your code should be: $font_awesome_icon = get_post_meta(get_the_ID(), 'font-awesome-icon', true);


0

As you can see here, that font awesome class has many values stored in an array. To use the font-awesome-icon you have to show the array, which is why your code $font_awesome_icon = get_post_meta(get_the_ID(), 'font-awesome-icon',array('size' => 'whatever')); works fine even if there is no value. I would suggest you provide the appropriate "fa" in ...


0

Try this where you need to get the url of the header image and you have set the default: $url = has_header_image() ? get_header_image() : get_theme_support( 'custom-header', 'default-image' );


0

Use shortcode: [theme-my-login show_title=0] or function: <?php theme_my_login( array( 'default_action' => 'login', 'show_title' => '0') ); ?>


1

Do not use any action in form. If you keep empty action of form then data will submit on same page if(isset($_POST["name"])) { echo $_POST["name"]; } <form action="" method="POST"> <input type="text" name="names" id="names"> <input type="submit" value="submit" name="submit_btn"> </form>


1

All thanks to @PieterGoosen's comment, I figured out that this issue was due to a setting within the WPML (multilingual) plugin. Under the 'translation management'->'multilingual content setup' tab of the plugin settings, there is a section for 'custom posts'. In this section, my 'publications' post type was not set for translation, and this somehow ...


0

use this code for solving your problem. $key_name = get_post_custom_values($key = 'Key Name'); echo $key_name[0];


0

With the help of Marcin Pietrzak, I got the answer // "select * from wp_options where option_name = 'wpcf-fields'"; $custom_fields = ( get_post_custom($post_id)); $querystr = "select * from wp_options where option_name = 'wpcf-fields'"; $pageposts = $wpdb->get_results($querystr, OBJECT); if(isset($pageposts) and isset($pageposts[0])): $value = ...


0

Yes this is fine and is a good practice, especially if your site may switch between HTTPS/HTTP (like for a shopping cart etc) that way you are not loading mixed content. As long as the CDN you are pulling from offers both HTTPS and HTTP you're fine, which they do.


-1

Replace all your the_content(); with echo do_shortcode(get_the_content());


0

Just add the full path: background-image:url('http://www.example.com/wp-content/themes/sage/assets/images/el_tracks.jpg'); or background-image:url('/wp-content/themes/sage/dist/images/el_tracks.jpg');


0

stephen's answer is good. but i put it one step further: <?php $location = 'footer_navigation3'; if (has_nav_menu($location)) : $menu_obj = get_menu_by_location($location); wp_nav_menu( array( 'theme_location' => $location, 'items_wrap'=> '<strong>'.esc_html($menu_obj->name).'</strong><ul id="%1$s" ...


1

Check this codex page. In the event that a child theme is being used, the parent theme directory URI will be returned. So if you want to include your other css files you just need to all your CSS files: add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent', ...


0

For adding JavaScript code in WordPress, you can create a .js file and include it in following way, in your theme's functions.php /** * Proper way to enqueue scripts */ function theme_name_scripts() { wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', ...


1

You can simply use require, require_once, include or include_once functions to include custom PHP files in your theme. require( 'folder/custom.php' ); Usually you should keep your custom PHP files in a folder. Developers vote against using require_once because it is a little slower than require since it requires the system to keep a log of what's already ...


0

The short answer is yes: You can use multiple CSS files in a WordPress theme. The main style.css file is used for holding the theme's information. You can leave the rest of it blank after that and write your own custom CSS files and include them inside the like you normally would. As for the HTML, that will be working fairly different from a normal HTML ...


2

I am working on something that uses images in a very similar fashion. As mentioned, you will need to implement custom meta boxes for your 'product' post type to create an image field. I use the CMB2 framework to build out the meta boxes. It provides several field types, one of which is file_list. File_list allows you to set multiple images via the ...


0

You can hook into the is_protected_meta filter and return true for any custom field you want to hide. add_filter('is_protected_meta', 'my_is_protected_meta_filter', 10, 2); function my_is_protected_meta_filter($protected, $meta_key) { return $meta_key == 'meta-name' ? true : $protected; }


0

Add your CSS rules to a Media Query at the end of your style sheet. @media only screen and (max-width: 768px) { // Your CSS Rules }


0

In my experience browscap.ini based checks are not terrible - at least. There is - probably not the only one - an PHP implementation with browsecap-php that can be used for PHP projects and would be suitable for WP projects too. As for a WordPress implementation, there is the plug-in - I know of - PHP Browser Detection, which as far as I can tell does a good ...


0

Service-backgrout font is missing, as it looks. You have to find that font family and upload to .../css/fonts directory.


0

You can drop external tools altogether with Loco Translate plugin. I've tried it about a year ago and never used POEdit since. Install it on your test site and create POT file with one click.


0

I found the solution in WordPress documentation. By setting WP_CONTENT_URL in wp-config.php file fixed my problem.


1

Create a template with a WP_Query to get posts with post type "post" then create a page and assign that template to that page. Templates: https://codex.wordpress.org/Templates Query by post type: https://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters


0

Paths are relative to bower_components/jquery-ui not bower_components/ "jquery-ui": { "main": [ "./themes/base/jquery-ui.sass", "./jquery-ui.js" ] } But i haven't solution for images...


0

To dinamically change the stylesheet and template URI you can use stylesheet_uri filter and template_directory_uri filter. For example: add_filter( 'stylesheet_uri', function( $stylesheet_uri ) { $stylesheet_uri = 'your new stylesheet URI here'; return $stylesheet_uri; } ); But, as you are using W3TC, you can configure that change in the ...


1

I Finally figure it out! By selecting the General settings under W3TC I selected CDN and CDN Type I then selected Generic Mirror. I then clicked on the CDN link under performance and was able to add my CDN URL and test the mirror! Pretty simple when you know how!


1

Because the problem is theme specific, I guessed that perhaps something in functions.php could be the culprit. I renamed the file to some random string and this resolved the problem. I then experimented by commenting out sections of functions.phpand discovered that wp_reset_password(...) caused the problem. I needed it only once anyway, so I removed it and ...


0

The default <title> can be handled by a template as a direct input in header.php or by the theme setup or options screen in backend. If your theme won't show up <title> tag in the header.php, then it's pretty likely than the functions.php file has something like this: add_theme_support( 'title-tag' ); You can remove that line and it won't ...



Top 50 recent answers are included