What is This esc_html_e() i wordpress php?

It’s a combination of _e(), which echoes a translatable string, and esc_html() which is for outputting text so that the text is not interpreted as HTML. You would use it to prevent HTML being smuggled into a translation and breaking your markup or causing security issues. For example, if your theme had: _e( ‘My translatable … Read more

Only get_posts of certain post formats

You can’t actually pass a taxonomy-related argument to get_posts(). (Edit: actually, yes you can. The Codex is just somewhat unclear. Looking at source, get_posts() is, at its heart, just a wrapper for WP_Query().) You can pass meta keys/values, and post types, but not taxonomies such as post format. So for this line: $myposts = get_posts(‘numberposts=-1&orderby=post_date&order=DESC’); … Read more

Return HTML Template Page with PHP Function

Something I forgot in my previous comment was that shortcodes return content, both the suggested include and my alternative get_template_part will directly output the content (which is what you are seeing with the content appearing at the top of your page instead of where the shortcode is called). To counteract this we must use output … Read more

Override get_template_directory() in child theme?

Late answer, but in WordPress 4.7 two new functions were introduced to address this question. get_theme_file_path() (for absolute file paths) and get_theme_file_uri() (for URLs) work just like get_template_part() in that they will automatically look in the child theme for that file first, then fallback to the parent theme. In your example, you could rewrite it … Read more

How to make a image-size selected by default in Media upload – WP v3.5

Try this out. Your add_filter()’s second argument is a function, that will affect the current option via a return: function theme_default_image_size() { return ‘custom-image-size-2’; } add_filter( ‘pre_option_image_default_size’, ‘theme_default_image_size’ ); You could also look into the pre_update_option_{$option} filter, and update the value once, so you don’t need to run this filter every time (may save 0.01s, … Read more

How does printf( __( ) ); work?

It’s used for translate text. The second argument is a kind of namespace (called domain here) to retrieve the translation (for example from a dedicated file or something else). So Anyword here, should be the guy behind the template, or the company or what ever that can be a domain/namespace. edit: The doc from wordpress … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş