Questions

How do you make a float div 100% height of the parent?

It seems hard. Most people use a table-cell solution or position absolute and relative. I can’t apply these to the bootstrap columns.

How do you change the number of posts per page in the archive page?

You add an action that does “$query->set( ‘posts_per_page’, 100 );” to the hook “pre_get_posts” in the functions.phpLook here:https://wordpress.stackexchange.com/questions/155409/increase-number-of-posts-in-archive-page

Why isn’t posts_nav_link() showing anything in my page?

posts_nav_link() only works for the default wp query (default wp loop). It will not work with custom wp queries. You need to manually overwrite the global $wp_query temporarily and then restore it back when done. I solved this by using the default wp query instead of making a custom one.

Can I have assign multiple values to the same meta_key in wordpress post_meta?

The database table supports its

How do you get a link to a custom post type archive?

get_post_type_archive_link( string $post_type )

How do you get a link to a category archive?

get_category_link( int|object $category )

Why is add_menu_page function undefned?

You have to “register” a function which calls it to the action “admin menu”. This function is not always available (not available when the plugin is loaded).

What is a wordpress text domain?

“You need to use a text domain to denote all text belonging to that theme. The text domain is a unique identifier, which makes sure WordPress can distinguish between all loaded translations. The text domain must match the slug of the theme.”

What does this mean in wordpress? __()

__( string $text, string $domain = ‘default’ )It means “retrieve the translation of $text.”. The first argument is the text, and the second is the domain (language?)

How do you add a menu item to the admin menu in wordpress?

add_menu_page() function.

How do you make a custom post type appear in a submenu instead of a main menu?

Add the option show_in_menu into the args array.

How do you add ajax in a wordpress plugin?

Ajax is included in wp core so it is easy. follow this: https://codex.wordpress.org/AJAX_in_PluginsWhy s my plugin ajax always returning 0?You have to make sure you name it correctly: “myActionName” in first and second arguments must be the same!!add_action(‘wp_ajax_nopriv_myActionName’, ‘myActionName’);add_action(‘wp_ajax_publication_myActionName’, ‘myActionName’);

How do I use javascript scripts in a plugin?

Follow here: https://code.tutsplus.com/articles/how-to-include-javascript-and-css-in-your-wordpress-themes-and-plugins–wp-24321function register_plugin_scripts(){ // Register the script like this for a plugin: wp_register_script( ‘excellent-engineering-portfolio-admin-script’, plugins_url( ‘/js/excellent-engineering-portfolio-admin.js’, __FILE__ ) ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( ‘excellent-engineering-portfolio-admin-script’ );}add_action( ‘wp_enqueue_scripts’, ‘register_plugin_scripts’ );Why am I getting $ not existing error in javascript?Replace all $ with the word jQuery.Load your script like this:jQuery( document ).ready(function() {…});

How do you make a plugin?

Just make a folder in the wp-content/plugins directory with the name of your plugin, and put a php file in there with the name of your plugin, and put the appropriate header it it (this is how wp knows the plugin name).Use it in the same way as functions.php

How does a nonce work?

WordPress generates a nonce (has) which is limited-time use and provides it the user within a form when the user requests the form. When you want to do a post request to the form, the nonce must be included into the url (wordpress sticks it on the end automatically). Then wordpress will check the nonce is there and that it matches before it will process the request.Nonces are not foolproof though.

What is a wp_nonce_field?

“It is used to validate that the contents of the form came from the location on the current site and not somewhere else.”

How can I link two custom post types in wordpress together?

It’s not easy, you need to use a plugin or write custom code.There is a good example of code here:https://wordpress.stackexchange.com/questions/129523/how-to-connect-different-cpts-together/130858#130858This example walks you how to:1. register two custom post types2. Add a generic metabox into the compose new post page for type 13. In the metabox, add a pulldown menu that lists all the existing entries for type 2 (uses wp query)4. Add a function that saves the content5. You can also change the table on the “manage posts” page to show type 2 as a column for type 1

How do you make a featured post wordpress?

You need a plugin or to write it yourself.Plugin: http://www.wpbeginner.com/plugins/how-to-feature-a-page-in-wordpress/Custom: http://smallenvelop.com/how-to-create-featured-posts-in-wordpress/Jetpack plugin may also be able to do it

How do you reverse post order in wp query?

You can specify the returned results ordering in the query (argument into new query):’order’ => ‘ASC’,’orderby’ => ‘date’

How are custom fields stored in the database?

They are stored in wp_postmeta with post_id set equal to the corresponding post and with meta_key the same as the post variable name.How do you get the first child of an element in php?Convert the string to a DOMNode by first loading the string using DOMDocument.Then use the .firstChild() function.Put together, it looks like ths:(new DOMDocument())->loadHTML(“{$str}“)->documentElement->firstChild;Actually this is wrong! You cannot chain together calls like this in php. Need to separate like this: $d = new DOMDocument(); $d->loadHTML(“{$str}“); $d->firstChild;

In php how do you check if something is an array?

is_array(). You need to call this before a foreach loop. A non-existing array would cause a warning if you tried to loop through it.

How do I add a list builder in a custom metabox in wordpress?

There is no built in functionality for this. You need to build it manually using jquery. See here: https://wordpress.stackexchange.com/questions/36750/add-x-meta-box-inputs-based-on-form-at-top-of-meta-box-how-to-do-it-right?rq=1

How do I add the editor to a textarea in a custom metabox?

Make a call to wp_editor with the appropriate arguments instea of using textarea.

How do i rearrange the order of meta boxes in the wordpress compose post screen?Several ways:

Users can drag and drop and rearrange them by themselves (the order will be saved for the future).Use position specifiers like high, core, normal, side.Use an action on hook: add_action( ‘do_meta_boxes’,…)

What is a wordpress excerpt?

It is an optional summary or description of a post. It is a built-in wordpress feature. It is not enabled by default though, it needs to be added by the theme in functions.php. This feature is often used in the following places:Search resultsTag archivesCategory archivesMonthly archivesAuthor archives

How to upload xml file of posts to wordpress?

Follow the instructions here: https://codex.wordpress.org/Post_TypesBasically, it involves:1. In functions.php, call register_post_type and bind it to a hook (the init hook).

How are custom taxonomies stored in the database?

I’m not sure because my custom taxonomy disappeared from the database once I erased it.It seems to go in wp_term_taxonomy table with columns term_id and term_taxonomy_id.wp_term_taxonomy table is linked to wp_terms table through term_id – it just gives names and slugs for different “terms”.wp_term_taxonomy table is linked to wp_term_relationships through term_taxonomy_id. This table lists a bunch of object_ids (I think page/post ids) and then tells which taxonomy they are classified under through term_taxonomy_id.

Why/when would you use a custom taxonomy?

It seems like you would use them in the same way as tags or categories: to classify something. An example is making taxonomies called “genre” and “actor” for TV shows, and a custom post type called “TV show”. Things like “episode number” and “season number” should be custom post meta data (not taxonomies) because you never need to pull out all “episode 1” for all shows or all “season 1” for all shows. Taxonomies should “stand alone”.Note that querrying for a taxonomy term is much faster than querying for a post meta. http://ottopress.com/2011/when-to-not-use-a-custom-taxonomy/

What is a custom taxonomy?

It is a way to make hierarchies/categories. WP has 4 built-on taxonomies: category, tag, link category, post format. You can ‘attach’ taxonomies to posts or other objects, and they will show up as meta boxes on the create post page. They see to work similar to tags.

How do you display custom post fields in the template?

Use get_post_meta($post_id, $key, $single); or get_post_custom(). get_post_custom() returns an array of all the post meta fields of the current post. It includes some built-in post meta fields including: _edit_last, _edit_lock, _thumbnail_id. Note that each of the values in this associative array is an array itself. So you need to do get_post_custom()[“my_metadata_name”][0] and you need to echo it.

How can I add custom fields to my custom post types in the editor?

It involves editing functions.php and calling the function add_meta_box there and binding it to the admin_init action. This should create the html for the form/input/text input area and what to name the variables when the form is submitted through http post. Then, you have to also bind to the save_post action to save the post variables into global $post;. Then to output it in your template, you need to Follow this link:http://blog.teamtreehouse.com/create-your-first-wordpress-custom-post-type

Why isn’t wordpress using the page template I made for displaying my custom post type?

You may need to “flush” the permalink settings – just go to admin panel -> settings -> permalinks and change it.

How do you add custom page types in wordpress?

It is actually called “custom post type” not “custom page type”. Custom post types are a little different from custom post categories. Custom post types will get their own tab on the admin panel. You can also add your own meta fields in the post editor. The URL is like: mywordpresssite/custompagetypename/specificcustomppage. You can also use page templates for custom page types, just name them like this: single-{post_type}.php and archive-{post_type}.php.I read that it is recommended to implement custom page types as plugins rather than within themes so that they will still be displayed properly when you switch themes. It is also better to add a short prefix to the custom post type identifier string in order to avoid name conflicts with other themes/plugins.

How do you add meta tags to wordpress?

There is no built-in functionality in wordpress to add page-dependent meta tags. You can hijack the site description input in customizer and output it to a meta tag in your template. Otherwise you have to built it into your theme or use a plugin like Yoast. Anyway, gooogle doesn’t use the meta tags in the search rankings anymore so it isn’t important.

What is a walker class?

“The walker class is an abstract class designed to help traverse and display elements which have a hierarchical (or tree like) structure.”. WordPress uses it for the navigation menus. It walks through the nav tree and outputs html.

How do you add a class to li in wordpress navigation?

You need to add a ‘filter’ in functions.php like this:https://wordpress.org/support/topic/add-classes-to-wp_nav_menu-list-items-and-anchors/Or alternately, you can write a customized walker like in the comments here:https://developer.wordpress.org/reference/functions/wp_nav_menu/

What is the viewport meta tag?

It is used for telling the browser how to control the page’s dimensions and scaling. “width=device-width” tells the browser to set the page width to the device width (what else would it set it to if you omitted this?!) and “initial-scale=1.0” tells it to how to scale it.It is an html 5.0 feature.Some hints for displaying pages nicely on different viewports:- Do not use large fixed-width images/elements.- Use CSS media queries.What is a CSS media query?They tell browser to render different CSS depending on something about the screen (usually viewport width). For example:@media screen and (min-width: 480px) { .my-div { width: 400px; }}.my-div { width: 200px;}This tells the browser to display .my-div with a diwth of 200 px if the browser window is narrow, and display it with a width of 400 px only if the browser window is wide (over 480 px wide).

Why is my webpage displaying small in chrome developer tools mobile view?

You need to add the viewport tag;

Where can I find documentation for old versions of bootstrap?

The website only has documentation for the latest release. Look here. Bootstrap changes pretty often (v4 is not so stable)Documentation:https://ingresso.github.io/ingresso-bootstrap/components/navbar/Code only:https://github.com/cdnjs/cdnjs/tree/master/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css

In bootstrap, do columns need to be inside rows?

Not sure. See answer to the previous question.

In bootstrap, do rows need to be inside containers?

The answer isn’t easy to find on google. But I think it would probably work better if they were.Containers:”.container” adds 15px padding and have auto margins.The width is determined by “max-width” (either 576, 720, or 940 depending on the media query, and if it gets smaller than 554, then it is as wide as it can be (viewport size). The margins are “auto”- meaning the margin widths are adjusted on both sides to keep the fixed-width container centered. The margin becomes 0 if the viewport is smaller than 554.”.container-fluid” also adds 15 px padding, but the width is just 100% (just as the default for block elements) and the width is not controlled through media queries.The 15 px padding in both .container and .container-fluid is necessary because “.row” has -15 px margin, so container and row work together to keep row contents perfectly flush up to the edges of the page..container and .container-fluid seem to display the same on narrow viewports.Rows: .row has -15px margin (not padding). This seems to be their only function.Columns:.col classes have a viewport width declaration and a column width declaration (like .col-md-6). The width is set as a percentage (of the containing element) based on the number together with media queries. Offset classes (like .col-md-offset-3) work by setting margin-left as apercentage. They have 15px padding. They are display:block, position:relative, and float:left.Overall, I think that using container and col without row is fine, except for the following problem:If you use container and column without a row in between, when the viewport is narrow (like on a smartphone) you will have double 15 px margins (30 px margins) which is a little wide.I also think that using row and col without container is fine. Thiw will mean that when the viewport is narrow (like on a smartphone) the margin will be 0px, meaning content is flush up against the side. And you loose the fixed-sizing of the .container class for bigger viewports, which is kind of nice. This seems to be almost the same as using a .container-fluid around .row and .col. The only difference is the 15px padding will be present even when the viewport is narrow.When you nest columns, you don’t need container: just nest like row > col > row > col.

What is the difference between
and
tags in html5?

“Article” is an independent block (complete and self-contained. It can be shared alone). For example, news articles or blog posts or widgets. It is ok to nest them. Articles usually should have a

.”Section” is a generic section with one theme. Section should have an h1-h6 element identifying the theme.It seems that there is a lot of differing opinions about this.W3C explains it in terms of outlines/hierarchies.The ‘header’ element represents introductory content for its nearest ancestor sectioning content or sectioning root element.

Is it good practice to split php block open and close brackets with php mode on/off?

Is it good practice to split html open and close tags between different template files?

How do you ake a link to an internal wordpress page?

With the following, where a-test-page is the slug.If the page is a child page of a parent page, you need to add another level for the slug of the parent page.a test pageThis seems to not be working for me…

How can you link to static pages in wordpress templates?

You cannot really. If you want wordpress to process the page (for example you want to use get_header functions etc.), you need to use the “custom page templates” functionality. Create a page called custompaget1.php with this as the first line: , (This string is what tells wordpress what this page template is called and it is displayed in the template selection when you create a page through the admin panel.) upload it in the root folder of your theme, and then from the admin panel, create a new page and select this template. Or, if you named your template page-customt1.php and your page customt1, then the corresponding templatee will get used automatically without you manually selecting it.Actually it is possible. Name your page page-mypage.php, put it in the root directory of your theme, and then make the link like: href=”mypage”. In this way you don’t need to make any pages in the database through the admin.

What is the difference betweeen template_directory and template_url?

They are the same. For child themes they return the parent template directory though so be careful.

Do I need to add the wp_head() and wp_footer() hooks?

Not necessarily but probably should. Most themes support these hooks. Many plugins may use these hooks. The footer hook is often used for jquery and adding script.s The head hook is often used for adding custom css or scripts. If you will not use plugins its ok but to be safe its better to put them there.

How do I add multilanguage support to the labels for the controls on the theme customizer?

I think you need a plugin, like WPML (The WordPress Multilingual Plugin) or WPGlobus, or Polylang.

What is the name of the format that wordpress customization strings stored in the database in?

(For example: a:2:{s:10:”link_color”;s:7:”#ff4f7d”;}, which indictes an array with two entries, which include a string with 10 letters and a string with 7 letters)This is a string that was created using php’s “serialize” function and can be decoded back by using the “unserialize function. It is different from the JSON format.

What is ob_start() and ob_get_clean()?

They are php functions, not wordpress functions. They start/discard the output buffer. ob_start() will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

How many wordpress themes are there?

5000 on wordpress.org, 11,000 on theme forest.There aren’t many in Japanese. Top google results are all theme vendors rather than theme compilation websites.

How do you wrap long words in css?

.hyphenate { overflow-wrap: break-word; word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; -moz-hyphens: auto; hyphens: auto;}

What is a wordpress widget?

Documentation says: WordPress Widgets add content and features to your Sidebars. Examples are the default widgets that come with WordPress; for Categories, Tag cloud, Search, etc. Plugins will often add their own widgets.WordPress widgets were originally created to provide a simple and easy-to-use way of giving design and structure control of the WordPress theme to the user. Widgets can be easily dragged and dropped into a specific widget area.Widgets in WordPress allow you to add content and features in the widgetized areas of your theme which is mostly the sidebar. However these widget-ready areas can be in the header, footer, sidebar, below content, and basically any other area in your theme. The available widget areas that you have in your theme will vary from theme to theme.

How do you make a wordpress child theme?

It is easy. It’s basiclly the same way you create a normal theme.Make afolder in the wp-content/themes directory, put style.css and functions.css in it (you don’t need index.php), and in style.css, add the correct wordpress header at the top of the file and make sure to include this line in it, which is what tells wordpress which theme it is a child of: Template: parentthemefoldernameThen in functions.php, you need to tell wordpress to load the parent’s stylesheet, then the child stylesheet, like this:get(‘Version’) );}add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );?>You can also use child themes to override template files (for example, content.php). Just make a file of the same name in the child directory.

What is a wordpress child theme?

It inherits the functionality and styling of the parent theme. You can modify the parent theme through the child theme. It is recommended to use child themes to make modifications rather than modifying the parent theme directly, so that your modifications are not lost when you update the parent theme.You should use child themes if you need to modify the parent theme’s html or php. If you just need to modify css, you can use a css customization plugin (many themes include this functionality). Actually, css customization is included as part of the wordpress core as of version 4.7 in the customizer.

When do you have to use the “after_setup_theme” hook in wordpress?

Not sure. The documentation says that this hook means: This hook is called during each page load, after the theme is initialized. It is generally used to perform basic setup, registration, and init actions for a theme. For example, in the twentytwelve setup, in this hook, they add theme support for post thumbnails, translations, style the visual editor, and adds “changeable headder business”.

What is a wordpress hook?

Hooks are functions provided by wordpress to plugins that enable the plugin to tell wordpress to call functions at certain times/points in the html document.Hooks are classified into either “action functions” or “filter functions”.A list of action hook names is here: https://codex.wordpress.org/Plugin_API/Action_ReferenceA list of filter hook names is here: https://codex.wordpress.org/Plugin_API/Filter_ReferenceFor example, in the above code, ‘customize_register’ and ‘wp_enqueue_scripts’ are bot action hooks. The line add_action(‘customize_register’, ‘theme_customize_register’) tells wordpress to call the function ‘theme_customize_register’ at the hook ‘customize_register’.

How do you add custom color support in wordpress?

Follow this link:https://www.cssigniter.com/how-to-create-a-custom-color-scheme-for-your-wordpress-theme-using-the-customizer/It is not as easy as adding custom header image and custom logo support.Baically it involves registering it in the functions.php file:First you need to add this line to functions.php:add_action( 'customize_register', 'theme_customize_register' );For every setting you want to register, you need to add a call to $wp_customize->add_setting and $wp_customize->add_control, as below. This will create a tab called “colors” in the customizer, under which there will be a section called “Text color”. The control type is a “WP_Customize_Color_Control” which is a color picker.

function theme_customize_register( $wp_customize ) {	// Text color - creates a "setting" (stored in databae?) identified by the string 'text_color'.    $wp_customize->add_setting( 'text_color', array(      'default'   => '',      'transport' => 'refresh',    ) );    // Hooks up a color control to the setting called 'text_color' under the section 'colors' in the customizer with a label 'Text color'.    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'text_color', array(      'section' => 'colors',      'label'   => esc_html__( 'Text color', 'theme' ),    ) ) );}add_action( 'customize_register', 'theme_customize_register' );

This creates an entry in the wp_options table under theme_mods_mythemename with key=’text_color’ and value= the hex string of the color.Now that we have the setting and the control for the setting, we need a way to output the setting’s value into css. To do that, use this code in functions.php:

		body {			color: ;		}		

This gets the theme mods from the database and makes css and adds in between