<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>WordPress DK Forum Topic: Hjælp til at insætte kode i functions.php</title>
		<link>http://wp-danmark.dk/forum/topic/hj%c3%a6lp-til-at-ins%c3%a6tte-kode-i-functionsphp</link>
		<description>WordPress DK Forum Topic: Hjælp til at insætte kode i functions.php</description>
		<language>da-DK</language>
		<pubDate>Thu, 06 Aug 2026 05:47:24 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Søg]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://wp-danmark.dk/forum/search.php</link>
		</textInput>
		<atom:link href="http://wp-danmark.dk/forum/rss/topic/hj%c3%a6lp-til-at-ins%c3%a6tte-kode-i-functionsphp" rel="self" type="application/rss+xml" />

		<item>
			<title>Equeone om "Hjælp til at insætte kode i functions.php"</title>
			<link>http://wp-danmark.dk/forum/topic/hj%c3%a6lp-til-at-ins%c3%a6tte-kode-i-functionsphp#post-61704</link>
			<pubDate>søn, 15 mar 2015 21:03:58 +0000</pubDate>
			<dc:creator>Equeone</dc:creator>
			<guid isPermaLink="false">61704@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Her i min Functions.php.. Håber der er nogle der kan hjælpe mig..&#60;/p&#62;
&#60;p&#62;på forhånd tak.. &#60;/p&#62;
&#60;p&#62;Martin &#60;/p&#62;
&#60;p&#62;&#60;code&#62; &#38;lt;&#38;lt;?php&#60;br /&#62;
/**&#60;br /&#62;
 * puresimple functions and definitions&#60;br /&#62;
 * @package Pure_and_Simple&#60;br /&#62;
 * @since 1.0.0&#60;br /&#62;
 */&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Set the content width based on the theme's design and stylesheet.&#60;br /&#62;
 */&#60;br /&#62;
	if ( ! isset( $content_width ) ) {&#60;br /&#62;
		$content_width = 1140; /* pixels */&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Sets up theme defaults and registers support for various WordPress features.&#60;br /&#62;
 *&#60;br /&#62;
 * Note that this function is hooked into the after_setup_theme hook, which&#60;br /&#62;
 * runs before the init hook. The init hook is too late for some features, such&#60;br /&#62;
 * as indicating support for post thumbnails.&#60;br /&#62;
 */&#60;br /&#62;
if ( ! function_exists( 'puresimple_setup' ) ) :&#60;/p&#62;
&#60;p&#62;function puresimple_setup() {&#60;/p&#62;
&#60;p&#62;	/*&#60;br /&#62;
	 * Make theme available for translation.&#60;br /&#62;
	 * Translations can be filed in the /languages/ directory.&#60;br /&#62;
	 * If you're building a theme based on Pure &#38;amp; Simple, use a find and replace&#60;br /&#62;
	 * to change 'pure-and-simple' to the name of your theme in all the template files&#60;br /&#62;
	 */&#60;br /&#62;
	load_theme_textdomain( 'pure-and-simple', get_template_directory() . '/languages' );&#60;/p&#62;
&#60;p&#62;	// Add default posts and comments RSS feed links to head.&#60;br /&#62;
	add_theme_support( 'automatic-feed-links' );&#60;/p&#62;
&#60;p&#62;	/**&#60;br /&#62;
	 * This feature enables post-thumbnail support for a theme.&#60;br /&#62;
	 * @see &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails&#60;/a&#62;&#60;br /&#62;
	 */&#60;br /&#62;
	add_theme_support( 'post-thumbnails' );&#60;/p&#62;
&#60;p&#62;	/**&#60;br /&#62;
	 * Add callback for custom TinyMCE editor stylesheets. (editor-style.css)&#60;br /&#62;
	 * @see &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/add_editor_style&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/add_editor_style&#60;/a&#62;&#60;br /&#62;
	 */&#60;br /&#62;
	add_editor_style();&#60;/p&#62;
&#60;p&#62;	/**&#60;br /&#62;
	 * Add support for shortcodes in text widget&#60;br /&#62;
	 * @see &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/do_shortcode&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/do_shortcode&#60;/a&#62;&#60;br /&#62;
	 */&#60;br /&#62;
	add_filter('widget_text', 'do_shortcode');	&#60;/p&#62;
&#60;p&#62;	/*&#60;br /&#62;
	 * Enable support for Post Thumbnails on posts and pages.&#60;br /&#62;
	 *&#60;br /&#62;
	 * @link &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails&#60;/a&#62;&#60;br /&#62;
	 */&#60;br /&#62;
	//add_theme_support( 'post-thumbnails' );&#60;/p&#62;
&#60;p&#62;	// This theme uses wp_nav_menu() in one location.&#60;br /&#62;
	register_nav_menus( array(&#60;br /&#62;
		'primary' =&#38;gt; __( 'Primary Menu', 'pure-and-simple' ),&#60;br /&#62;
		'footer' =&#38;gt; __( 'Footer Menu', 'pure-and-simple' ),&#60;br /&#62;
	) );&#60;/p&#62;
&#60;p&#62;	/*&#60;br /&#62;
	 * Switch default core markup for search form, comment form, and comments&#60;br /&#62;
	 * to output valid HTML5.&#60;br /&#62;
	 */&#60;br /&#62;
	add_theme_support( 'html5', array(&#60;br /&#62;
		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'&#60;br /&#62;
	) );&#60;/p&#62;
&#60;p&#62;	/*&#60;br /&#62;
	 * Enable support for Post Formats.&#60;br /&#62;
	 * See &#60;a href=&#34;http://codex.wordpress.org/Post_Formats&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Post_Formats&#60;/a&#62;&#60;br /&#62;
	 */&#60;br /&#62;
	add_theme_support( 'post-formats', array(&#60;br /&#62;
		'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio'&#60;br /&#62;
	) );&#60;/p&#62;
&#60;p&#62;	// Setup the WordPress core custom background feature.&#60;br /&#62;
	add_theme_support( 'custom-background', apply_filters( 'puresimple_custom_background_args', array(&#60;br /&#62;
		'default-color' =&#38;gt; '3d4147',&#60;br /&#62;
		'default-image' =&#38;gt; get_template_directory_uri() . '/images/page-bg.jpg',&#60;br /&#62;
	) ) );&#60;br /&#62;
}&#60;br /&#62;
endif; // puresimple_setup&#60;br /&#62;
add_action( 'after_setup_theme', 'puresimple_setup' );&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Enqueue scripts and styles.&#60;br /&#62;
 */&#60;br /&#62;
function puresimple_scripts() {&#60;/p&#62;
&#60;p&#62;	wp_enqueue_style( 'puresimple-responsive', get_template_directory_uri() . '/css/responsive.min.css', array( ), '3.1.1' );&#60;br /&#62;
	wp_enqueue_style( 'puresimple-fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.2.0' );&#60;br /&#62;
    wp_enqueue_style( 'puresimple-opensans', get_template_directory_uri() . '/css/font-opensans.css', array(), '1.0.2' );&#60;br /&#62;
	wp_enqueue_style( 'puresimple-style', get_stylesheet_uri() );&#60;/p&#62;
&#60;p&#62;	wp_enqueue_script( 'puresimple-global', get_template_directory_uri() . '/js/global.min.js', array( 'jquery' ), '20141001', true );&#60;/p&#62;
&#60;p&#62;	if ( is_singular() &#38;amp;&#38;amp; comments_open() &#38;amp;&#38;amp; get_option( 'thread_comments' ) ) {&#60;br /&#62;
		wp_enqueue_script( 'comment-reply' );&#60;br /&#62;
	}&#60;br /&#62;
}&#60;br /&#62;
add_action( 'wp_enqueue_scripts', 'puresimple_scripts' );&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Implement the Custom Header feature.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/custom-header.php';&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Custom template tags for this theme.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/template-tags.php';&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Custom functions that act independently of the theme templates.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/extras.php';&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Customizer additions.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/customizer.php';&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Load widgets.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/widgets.php';&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Get inline CSS.&#60;br /&#62;
 * If you need to edit this file, open the unminified version of the inline-css.php file.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/inline-css.min.php';&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Load Jetpack compatibility file.&#60;br /&#62;
 */&#60;br /&#62;
require get_template_directory() . '/inc/jetpack.php';&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Equeone om "Hjælp til at insætte kode i functions.php"</title>
			<link>http://wp-danmark.dk/forum/topic/hj%c3%a6lp-til-at-ins%c3%a6tte-kode-i-functionsphp#post-61703</link>
			<pubDate>søn, 15 mar 2015 21:02:23 +0000</pubDate>
			<dc:creator>Equeone</dc:creator>
			<guid isPermaLink="false">61703@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Hey folkens&#60;br /&#62;
Jeg har købt gravity forms til 2 sider jeg er ved at sætte op. Men jeg er løbet ind i et problem med at GF ikke kan regne med decimaler, så jeg bliver nød til at indsætte en kode i min Functions.php.. Jeg har prøvet et par gange men hvergang kan vil siden ikke åbne bagefter og her sidste gang lavede jeg kage i det og nu er der en grå bar over min header.. har brug for hjælp til at få den kode in i min functions.php og bagefter fjerne den grå bar der nu er dukket.. &#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#38;lt;?php&#60;br /&#62;
/**&#60;br /&#62;
* Gravity Wiz // Gravity Forms // Accept Decimal Values for Quantity Fields&#60;br /&#62;
*&#60;br /&#62;
* Allows you to accept decimal values in Quantity fields, converting any Quantity field into a weight field.&#60;br /&#62;
*&#60;br /&#62;
* @version	 1.1&#60;br /&#62;
* @author    David Smith &#38;lt;david@gravitywiz.com&#38;gt;&#60;br /&#62;
* @license   GPL-2.0+&#60;br /&#62;
* @link      &#60;a href=&#34;http://gravitywiz.com/enable-decimal-values-in-quantity-fields/&#34; rel=&#34;nofollow&#34;&#62;http://gravitywiz.com/enable-decimal-values-in-quantity-fields/&#60;/a&#62;&#60;br /&#62;
* @copyright 2014 Gravity Wiz&#60;br /&#62;
*/&#60;br /&#62;
class GW_Quantity_Decimal {&#60;/p&#62;
&#60;p&#62;	private static $_current_form;&#60;/p&#62;
&#60;p&#62;    function __construct( $form_id, $field_ids = array() ) {&#60;/p&#62;
&#60;p&#62;        if( ! is_array( $field_ids ) )&#60;br /&#62;
            $field_ids = array( $field_ids );&#60;/p&#62;
&#60;p&#62;	    $this-&#38;gt;form_id = $form_id;&#60;br /&#62;
        $this-&#38;gt;field_ids = $field_ids;&#60;/p&#62;
&#60;p&#62;        add_action( 'init', array( $this, 'init' ) );&#60;/p&#62;
&#60;p&#62;    }&#60;/p&#62;
&#60;p&#62;	function init() {&#60;/p&#62;
&#60;p&#62;		// make sure Gravity Forms is loaded&#60;br /&#62;
		if( ! class_exists( 'GFForms' ) ) {&#60;br /&#62;
			return;&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;		add_filter( 'gform_validation_' . $this-&#38;gt;form_id, array( $this, 'allow_quantity_float' ) );&#60;/p&#62;
&#60;p&#62;		if( GFFormsModel::is_html5_enabled() ) {&#60;br /&#62;
			add_filter( 'gform_pre_render', array( $this, 'stash_current_form' ) );&#60;br /&#62;
			add_filter( 'gform_field_input', array( $this, 'modify_quantity_input_tag' ), 10, 5 );&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;	}&#60;/p&#62;
&#60;p&#62;    function allow_quantity_float( $validation_result ) {&#60;/p&#62;
&#60;p&#62;        $form = $validation_result['form'];&#60;br /&#62;
        $has_validation_error = false;&#60;/p&#62;
&#60;p&#62;        foreach( $form['fields'] as &#38;amp;$field ) {&#60;/p&#62;
&#60;p&#62;            if( $this-&#38;gt;is_enabled_field($field) &#38;amp;&#38;amp; in_array($field['type'], array('product', 'quantity')) &#38;amp;&#38;amp; in_array( $field['validation_message'], array(__(&#34;Please enter a valid quantity. Quantity cannot contain decimals.&#34;, &#34;gravityforms&#34;), __(&#34;Please enter a valid quantity&#34;, &#34;gravityforms&#34;)) ) ) {&#60;br /&#62;
                $is_numeric = $field['type'] == 'product' ? GFCommon::is_numeric( rgpost( &#34;input_{$field['id']}_3&#34; ), &#34;decimal_dot&#34; ) : GFCommon::is_numeric( rgpost( &#34;input_{$field['id']}&#34;), &#34;decimal_dot&#34; );&#60;br /&#62;
                if( $is_numeric )&#60;br /&#62;
                    $field['failed_validation'] = false;&#60;br /&#62;
            }&#60;/p&#62;
&#60;p&#62;            if( $field['failed_validation'] )&#60;br /&#62;
                $has_validation_error = true;&#60;/p&#62;
&#60;p&#62;        }&#60;/p&#62;
&#60;p&#62;        $validation_result['form'] = $form;&#60;br /&#62;
        $validation_result['is_valid'] = ! $has_validation_error;&#60;/p&#62;
&#60;p&#62;        return $validation_result;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;	function stash_current_form( $form ) {&#60;br /&#62;
		self::$_current_form = $form;&#60;br /&#62;
		return $form;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	function modify_quantity_input_tag( $markup, $field, $value, $lead_id, $form_id ) {&#60;/p&#62;
&#60;p&#62;		$is_correct_form         = $this-&#38;gt;form_id == $form_id;&#60;br /&#62;
		$is_correct_stashed_form = self::$_current_form &#38;amp;&#38;amp; self::$_current_form['id'] == $form_id;&#60;/p&#62;
&#60;p&#62;		if( ! $is_correct_form &#124;&#124; ! $is_correct_stashed_form &#124;&#124; ! $this-&#38;gt;is_enabled_field( $field ) ) {&#60;br /&#62;
			return $markup;&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;		$markup = $this-&#38;gt;get_field_input( $field, $value, self::$_current_form );&#60;/p&#62;
&#60;p&#62;		$search  = 'type=\'number\'';&#60;br /&#62;
		$replace = $search . ' step=\'any\'';&#60;br /&#62;
		$markup  = str_replace( $search, $replace, $markup );&#60;/p&#62;
&#60;p&#62;		return $markup;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	function get_field_input( $field, $value, $form ) {&#60;/p&#62;
&#60;p&#62;		remove_filter( 'gform_field_input', array( $this, 'modify_quantity_input_tag' ), 10, 5 );&#60;/p&#62;
&#60;p&#62;		$input = GFCommon::get_field_input( $field, $value, 0, $form['id'], $form );&#60;/p&#62;
&#60;p&#62;		add_filter( 'gform_field_input', array( $this, 'modify_quantity_input_tag' ), 10, 5 );&#60;/p&#62;
&#60;p&#62;		return $input;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;    function is_enabled_field( $field ) {&#60;br /&#62;
        return is_array( $this-&#38;gt;field_ids ) &#38;amp;&#38;amp; ! empty( $this-&#38;gt;field_ids ) ? in_array( $field['id'], $this-&#38;gt;field_ids ) : true;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;# accept quantity as decimal for a single field&#60;br /&#62;
new GW_Quantity_Decimal( 529, 1 );&#60;/p&#62;
&#60;p&#62;# accept quantity as decimal for a group of fields&#60;br /&#62;
// new GW_Quantity_Decimal( 34, array( 1, 3 ) );&#60;/code&#62;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
