Articles of functions

Differences when using the the_time and the_date functions

I have some doubts about how work the WordPress the_date() functions definied into general-template.php In a page I show the posts archive using this code snippet into a loop: <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <header> <h3 class=”entry-title”> <a href=”<?php the_permalink(); ?>” title=”<?php printf(__(‘Permalink to %s’, ‘your-theme’), the_title_attribute(‘echo=0’)); ?>” rel=”bookmark”><?php the_date(“d/m/Y”); echo ” – […]

How to mass-delete inline styles in WordPress custom post type automatically?

I’m looking for a pragmatic way to delete about 100+ individual pages worth of inline styles. I had entered in content for a client by copying and pasting from Word, which took all that data with it and wrapped it in inline styles. It doesn’t make sense to go through each post individually. Has anyone […]

Date archives for custom post type

I have seen many questions/posts regarding this, but have yet to find a decent solution. Basically I am trying to do what wp_get_archives does, but for a custom post type (personally I am unsure why wp_get_archives doesn’t support custom post types!). The code I am currently using is as follows functions.php function Cpt_getarchives_where_filter( $where , […]

Execute a shortcode when clicking on a image

I asked this in stackovorflow under javascript and was informed not possible so I trying here I have a shortcode for a opt-in form and I want it to pop up when a image is clicked I tried the function in both the Header Scripts and my functions.php file. <img src=”someimage.png” onclick=”executeShortCode()” /> <script> function […]

Enabling post thumbnails for custom post type

I’m writing a custom post type as a plugin and trying to figure out how I can enable post thumbnails within plugin documentation/template instead of enabling it in the functions.php. I tried adding the code below inside custom-post-plugin.php and it doesn’t seem to work. I still have to write the code within the functions.php to […]

if has theme mod

Does someone know how to write the next line in wordpress PHP, because i’m not that great with PHP. If_theme_mode has content echo { my content } else { other content }; thnx

Child Theme Not Overriding Parent Theme

I know this question has been asked many times. I even spent the entire day yesterday getting things to work but to no avail. I am pretty sure I am missing out on something small//silly but I am unable to figure it out. So, here is my question: I have purchased the Identity-vcard theme from […]

Print Post Parent Title

I’m trying to print the posts’ parent title on the page as well as the post title for that page. This is how my content-page.php template currently renders the page title. the_title( ‘<header class=”entry-header”><h1 class=”entry-title”>’, ‘</h1></header><!– .entry-header –>’ ); I realise I can retrieve the posts’ parent title by doing this: $parent_title = get_the_title($post->post_parent); echo […]

Best practices for multiple Custom Feeds functions

I created two new WordPress RSS feeds in my theme functions: // Custom Feed 1 add_action(‘init’, ‘customRSS’); function customRSS(){ add_feed(‘feedname’, ‘customRSSFunc’); } function customRSSFunc(){ get_template_part(‘rss’, ‘feedname’); } // Custom Feed 2 add_action(‘init’, ‘customRSS2’); function customRSS2(){ add_feed(‘feedname2’, ‘customRSS2Func’); } function customRSS2Func(){ get_template_part(‘rss’, ‘feedname2′); } It’s working perfect, however based on the DRY concept I feel that […]

When 'is_post_type_archive()' return true?

I visit archive page link or, on either page is_post_type_archive() return false. I have added is_post_type_archive() in archive.php template file. I have tried putting is_post_type_archive() in and out the loop, use wp_reset_query() before the is_post_type_archive(), but all return false. How can I make is_post_type_archive() function return true?