Tag Info

New answers tagged

1

As Pages are a special built in Posttype, they get an own template hierarchy. Other "normal" post types and custom post types can only be templated by "single-$posttype.php". You can however hook into the single_template filter and make wordpress redirect to your template file: function get_custom_post_type_template($single_template) { global $post; ...


0

PHP (unlike HTML) is not meant to be used as content markup language. It is server–side language with too much access. It is very challenging to safely and securely treat PHP as part of content. For basic example — what if one of your authors writes PHP code in a post which amounts to "make me site's administrator"? While WP plugins implementing this do ...


0

You can use get_the_ID(); function to fetch the Id of the current post For more Please visit here


0

I've faced this issue many times in my Wordpress development. Simply follow these steps: Download the codes and files using FTP FileZilla or WinSCP (only on Winndows) or if you're having shell access then try to first compress the whole bunch of files it a tar.gz or zip and then download the single compressed file. Download the DB carefully, remember to ...


0

In the content.php, add code like this: if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', '$text_domain' ), __( '1 Comment', '$text_domain' ), __( '% Comments', '$text_domain' ) ); ?></span> ...


0

Right bellow the content (single post) <?php if (function_exists('paged_comments_template')) paged_comments_template(); else comments_template(); ?> And the approval you need change in the wordpress panel.


0

Use a new query outside the loop like this one $query = new WP_Query( 'category_name=ben affleck;post_type=post' ); if ( $query->have_posts() ) : while $query->have_posts() : $query->the_post(); // Loop output goes here endwhile; endif;


0

The web hosting provider should have a process available for gaining access to a control panel, FTP, etc. They will likely need your employer to prove ownership of the account somehow. From this access, you will have all that you need to duplicate the site and install a development version before beginning your edits.


0

The sweet and short of this, don't use get_posts if you need paginated queries. get_posts works perfectly if you are going to use a custom query that doesn't need pagination, but it really becomes a big complicated mess when you need to introduce pagination. I think the easiest and most appropriate here is to make use of WP_Query to construct your custom ...


0

Managed to do it by putting this into the loop: <?php if (has_term( $_GET["lang"], 'sprache' )) { ?> I was then able to creat links like .../autor/steve-perry/?lang=englisch to filter the search results the way I wanted to.


3

There is no hook to do this. Copy the index.php to the child theme and make the single line change. Also, tell the parent theme's author that they should make the same change in their theme, for flexibility.


3

I think it's not exactly possible the way you want to achieve. It's really annoying to not getting a filter there to alter template files names :( I have a workaround on it though. Let use content.php for the comparison. // content.php file $format = get_post_format(); if( '' != $format ){ get_template_part( 'content-'. $format ); } else{ ...


0

If you want to pull in a file called content-aside.php you call the function like this: get_template_part( 'content', 'aside' ); The second parameter is the name of the filer after the hyphen. If your file is in a sub-directory (templates/content-aside.php): get_template_part( 'templates/content', 'aside' ); Is that what you're looking to do?


0

The outdated files are in your theme's woocommerce folder (unless the theme has stored them elsewhere, but that is the default). You don't need this folder per se and can rename it (which is the more temporary way than flat-out deleting it) and WooCommerce will work. If you purchased the theme you could also contact their support and see about purchasing an ...


0

I can't comment on deflime's answer, but if you want a <select> you'll want to use the wp_dropdown_categories function


1

If you are referring to the categories from the post type post (the blog) then this would do the trick: For a drop-down: wp_dropdown_categories() For a list: wp_list_categories() child_of Only display categories that are children of the category identified by this parameter. There is no default for this parameter. <?php // Put the parent ...


2

Use below code for getting post format, simple made condition if post format ="standard" then load your preferred template $format = get_post_format(); if($format ="video") { get_template_part( 'format', $format ); } Something like this.


1

Define your template name in the custom template file. <?php /* Template Name: demo */ ?> After this the select template option will be available on the edit screen. You can choose the desired name you want.


1

See, It's quite difficult to have path like site/books/product_category/horror/ site/movies/product_category/horror/ As wordpress functionality will conflict between custom_post_type & their taxonomy if try to keep url like you mentioned. I suggest you consider the I mentioned below as a solution of your problem. ...


1

You are not wrong about conceptual limitation, but any development convention is inherently about constraints. Constraints are "bad", but they are also often good and important. In this specific case it's slightly soured by Settings API being especially nasty snowflake, which historically led people to reinvent this particular wheel a lot. However, your ...



Top 50 recent answers are included