Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter hregalis

    (@hregalis)

    This worked perfectly. Thanks for your help and your quick reply!

    Temporary workaround; this only works if you aren’t using post_content for anything. I didn’t think up this function, but modified it from a similar one; don’t have a link for it anymore though. To use this, add the function to your function.php and change the post type and custom fields to your own.

    function change_content($post_id) {
    
    	// If this is a revision, get real post ID
    	if ( $parent_id = wp_is_post_revision( $post_id ) )
    		$post_id = $parent_id;
    
    	//Get the post type and check if the post is the right type for the filter
    	$type = get_post_type( $post_id );
    
    	if ( $type=='your-custom-post-type') {
    
    		// unhook this function so it doesn't loop infinitely
    		remove_action( 'save_post', 'change_content' );
    
    		//Set the post content to be the specified custom fields
    		$cf_one = get_post_meta($post_id,'custom_field_one',true);
    		$cf_two = get_post_meta($post_id,'custom_field_two',true);
    		$post_content = $cf_one . ' ' . $cf_two;
    
    		// update the post, which calls save_post again
    		wp_update_post( array( 'ID' => $post_id, 'post_content' => $post_content) );
    		// re-hook this function
    		add_action( 'save_post', 'change_content' );
    	}
    }
    
    add_action( 'save_post', 'change_content' );
    //The two below are for WP User Frontend forms;
    //I think ACF has some of their own hooks too
    add_action('wpuf_edit_post_after_update', 'change_content');
    add_action('wpuf_add_post_after_insert','change_content');
    Thread Starter hregalis

    (@hregalis)

    Think I figured it out this time. I had Google PageSpeed enabled for this site, so I disabled that and now the child theme’s CSS is working correctly.

    Thread Starter hregalis

    (@hregalis)

    Or not. After this, I changed the CSS I had in the child theme, but the changes don’t show up. It still shows the old CSS I had in the child theme. If I go to View Page Source, it looks like this:

    <style id='twentyfourteen-style-css' media='all'>@import url(/wp-content/themes/twentyfourteen/style.css) ;a{color:#24890d;background-color:#24890d!important}h1.entry-title{font-weight:bold}</style>

    I disabled all the plugins I had active but it’s still like that. I cleared my browser cache and also tried it in different browsers and on my phone, but no luck. If I reactivate Twenty Fourteen, it goes away.

    Thread Starter hregalis

    (@hregalis)

    Aaaaaand answered my own question. I made a second child theme manually and that one works, so it looks like something went wrong with the plugin I was using.

    Thread Starter hregalis

    (@hregalis)

    Works perfectly. Thanks for your help!

    Thread Starter hregalis

    (@hregalis)

    Thank you! I tried it and taxonomy.php and taxonomy-category.php work, but taxonomy-tag.php doesn’t. Looking at the documentation in the link you posted, it looks like taxonomy-tag.php should work. I can work around it but am I doing the name wrong or is it supposed to work and doesn’t?

Viewing 7 replies - 1 through 7 (of 7 total)