New answers tagged

2

Paging a list of terms/categories/tags are quite easy, and to achieve that, you need minimal info. Lets look at we need the amount of terms the amount of terms per page get_terms() (Just note, the usage of get_terms() have changed in version 4.5). You can also use get_categories() if you wish, get_categories() is just a wrapper function for get_terms() ...


1

I'm not familiar with WP-PageNavi, but I suspect it assumes to be dealing with posts, so it might easily screw up if you use it on a loop like yours. Perhaps the css might still be helpful in styling your html. Anyway, setting up your own pagination is not that difficult. First, you need to know how many categories there are: $cat_amounts=count($cats); ...


0

Try this code <?php global $wpdb; $query_position = ""; $list_position = ""; $result_position = ""; $query_locations = ""; $list_location = ""; $result_location = ""; $query_processed = ""; $list_processed = ""; $result_processed = ""; $selected = ""; $query_position = $wpdb->get_results('SELECT DISTINCT position FROM resume_databank ORDER BY position ...


2

Custom page templates are for pages - not post type archives :) Naming your template file as archive-projects.php will cause Wordpress to select it for your Projects archive page. You also don't need the /* Template Name: Projects */ in there, as this template naming is default Wordpress behaviour. See the visual overview of the template hierarchy to ...


1

Great question. As far as I can tell there isn't a way to filter this list (there's a long trac ticket about a proposal to, if you're interested, and also related (but different) questions on this site here and here). Because there's no filter, you may have to resort to doing it with jQuery. We can add our own scripts to the admin footer using the ...


1

Your code is invalid (syntax error, missing closing array and semi-colon), and incorrectly nested - if you were to properly indent your code, you'd have something like: $args = array( 'tag' => 'tag-AAA,tag-BBB', array ( 'orderby' => array( 'title' => 'ASC', 'post_date' => 'DESC', ...


2

You could filter the include paths returned by get_included_files by removing any files from the list that are not in your theme (and/or child theme) directory: function get_theme_includes() { $includedfiles = get_included_files(); // normalize theme paths for matching $styledir = str_replace("\\","/",get_stylesheet_directory()); ...


0

I needed the code in functions.php so that I could re-use it. Here's my solution below: function get_img_alt($attachment) { $post = get_post(); $image_id = get_post_meta( $post->ID, $attachment, true ); $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', true); print $image_alt; }


0

<source src="<?php bloginfo('stylesheet_directory'); ?>/page-templates/yourfile.pdf" type="text/pdf" /> The bloginfo('stylesheet_directory') function will send you to your preset theme folder where all your files are... It's a best practice in linking your files from your theme directory folder... Be aware that scripts( jQuery, jQUI, etc) ...


0

Your paths should be: /wp-content/themes/gt3-wp-pure/page-templates/ ... instead of: public_html/wp-content/themes/gt3-wp-pure/page-templates/


-1

Use jQuery instead of $. e.g use jQuery('.parallax') instead of $('.parallax').


5

The workhorse is WP_Theme::get_page_templates() (wrapped by the helper function get_page_templates()). If you check out the source, you'll see: /** * Filter list of page templates for a theme. * * @since 3.9.0 * @since 4.4.0 Converted to allow complete control over the `$page_templates` array. * * @param array $page_templates Array of page ...


1

Technically, third party plugins are off-topic for this site. However this is an easy one - in the Custom Fields page in the admin area, go into your field group. Scroll right down to the bottom and there's a section allowing you to "hide" elements in the post. Select the "content" option here and you're done. Keep in mind that if you have multiple field ...


1

Well I was privileged enough to get the tumbleweed badge for this question. But I found the answer. Easy enough. Custom Upload Dir Plugin. Perfect for the job. Well, almost. With a little tweaking.


2

I can already tell that you're using ACF - if you don't want to change the return settings for the field, you can bypass ACF and just pull the image ID directly from post meta: $image_url = get_field( 'my_field_name' ); $image_id = get_post_meta( $post->ID, 'my_field_name', true ); $image_meta = wp_get_attachment_metadata( $image_id );


-2

<?php global $post; $child_pages_query_args = array( 'post_type' => 'page', 'post_parent' => '93', 'orderby' => 'date DESC' ); $child_pages = new WP_Query( $child_pages_query_args ); ?> <?php if ( $child_pages->have_posts() ) : while ( $child_pages->have_posts() ) : $child_pages->the_post(); ?> <div ...


2

Use wp_enqueue_scripts instead on init. This will ensure you the template is already loaded. add_action('wp_enqueue_scripts', 'maps_scripts'); Or you try to check the template using get_page_template_slug() instead of is_page_template: $tmp = get_page_template_slug($post_id); // provide page/post ID if('page-about.php' == $tmp) { // enqueue scripts ...



Top 50 recent answers are included