Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter idacma

    (@idacma)

    <?php /*?>for å få bort "posts på fremside"<?php */ ?> is just a comment so I know what the code is for, I really do not understand php so I have just copy pasted codes so cannot say what everything is for unfortunately, but trying to pick up as much as I can. Thank you for the info, will try and see if I can sort out the php file a little 🙂

    Thread Starter idacma

    (@idacma)

    ok never mind I was too quick in saying it did not work, I was able to get it fixed by removing all white space before all <?php and after all ?>. Thank you so much for your help! 😀

    • This reply was modified 5 years, 6 months ago by idacma.
    Thread Starter idacma

    (@idacma)

    Ok so that did not seem to work, my functions file looks like this (sorry about the comments being in a different language):

    <?php
        add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
        
    	function enqueue_parent_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' 
    	);
        }
        ?>
    
    <?php /*?>for å få bort "posts på fremside"<?php */ ?>
    <?php add_filter( 'gettext', 'change_front_page_title', 20, 3 );
    
    function change_front_page_title( $translated_text, $text, $domain ) {
    
    if (is_front_page()){
    
                switch ( $translated_text ) {
    
            case 'Posts' :
    
                $translated_text = __( 'Kommende utstillinger', 'twentyseventeen' );
                break;
        }
    }
    return $translated_text;
    }?>
    
    <?php /*?>Ikke få hele posten på fremside<?php */?>
    <?php function catch_that_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches [1] [0];
     
      if(empty($first_img)){ //Defines a default image
        $first_img = "/images/default.jpg";
      }
      return $first_img;
    }
    ?>
    • This reply was modified 5 years, 6 months ago by idacma.
    Thread Starter idacma

    (@idacma)

    Thank you, will try this right away, there was actually a lot of white space!

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