Questions

In c++ how to remove carriage returns? (\r)

Use this: mystring.erase(mystring.size() – 1);

In c++ why is cout printing my strings in backwards order?

This will happen if one of the strings contains a carriage return (See here: https://stackoverflow.com/questions/17537456/c-stdcout-and-string-printing-in-wrong-order)

What is the default wordpress xml format for importing posts?

What is automattic CodePoet?

CodePoet is a listing of wordpress “professionals” made by automattic which is the company behind wordpress.Actually it is not being updated anymore as of 2014.

What is this error? Google Maps API error: ApiNotActivatedMapError

Not sure. I used a different key and it worked.

What is the difference between php functions esc_html, esc_attr, esc_url?

What is CDATA in xml file?

It is a way to mark “character data” in an xml file – the parser should interpret this as “character data”, not xml. That means that inside the cdata section, you are free to have text that includes characters like > < " and & or tags

which means you can include html inside it.

What is ‘rewrite’ in custom post type definition?

It allows you to control how permalinks are made.

How do I put an ssl certificate on xampp?

How to fix the “Your connection is not private” eerror when I try to access my site using ssl?

It could be caused by not having an ssl certificate on your server/hosting.

What is an API key? Why are they needed? Why do you need to keep it private?

It is a code that is passed when a program/webpage calls an API. It is unique to that program that acts as both a unique identifier and token for authentication.They are needed to keep track of users to avoid malicious use/abuse of that service.They are also used to keep track of who makes requests to a particular service in order to calculate billing for paid services – that’s why you need to keep it secret!

Why is html code input into text widget not displaying?

Make sure to paste it in the “text” editor, not the “visual” editor.

What is https?

It is http encrypted with SSL. The data is encrypted so that other people listening on the network or even your provider cannot see what you browse (only what domain you accessed).The certificate also serves a way to identify that the site is trusted – the certificate is signed by an issuing authority.When a client requests an https page, first the server sends the public certificate to the client,Then, the “SSl handshake” is completed to establish the encrypted connection.

How to get url of current page in javascript?

var url = window.location.href; // Returns full URL

Why does “bookmark button” for hatena and “likes” button for facebook not work when I run my wordpress site on xampp?

These buttons work by calling a javascript script when they are pushed, which sends the url of the current page to the service’s server. On xampp, the webpage does not have a real url.

How does google analytics know when someone visits my site?

Google analytics puts cookies on the clients’ system using their analytics.js library. The cookie gets put on the system through the script tag in the html head that contains the tracking ID that you are required to paste into your page to enable tracking.

What is XML-RPC ?

From wikipedia: XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism..A client can “call a method” on a server by sending an XML-RPC request, which is the method call request encoded as an XML file sent over HTTP.The XML encoding includes the method name and method parameters and types, specified with XML tags.The server sends back the response in XML also.

What is an “update service” in wordpress?

From the wordpress codex: pdate Services are tools you can use to let other people know you’ve updated your blog.Whenever you update your site, wordpress will send an “XML-RPC ping” to the update services (Servers) you have listed in your wp-admin settings. These services will then update their indexes.Popular update services are technorati (it is not working anymore as of 2014 though). Connecting your site to an update service can increase traffic to your site because some people browse the updates on these services when they’re bored and could discover your updates.Actually, update services seem to be not important now as of 2017 because google has captured most of the share for blog searches, and the focus is placed on social networks rather than blogs anyway.

How can I make a batch file that will open up all the windows I need to work on wordpress development automatically with one click?

Paste the following in a file and end with extension “.bat”It starts xampp’s apache and mysql, opens chrome to the webpage and wp admin panel, opens file exploer to the theme folder, and opens a file in text my editor.start /B “APACHE_START.BAT” C:\xampp\apache_start.batstart /B “MYSQL_START.BAT” C:\xampp\mysql_start.bat”C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” http://localhost/wp-pacificmall/”C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” http://localhost/wp-pacificmall/wp-admin/explorer.exe “C:\xampp\htdocs\wp-pacificmall\wp-content\themes\pacificmall””C:\Program Files (x86)\Notepad++\notepad++.exe” “C:\xampp\htdocs\wp-pacificmall\wp-content\themes\pacificmall\front-page.php”

How do text editors auto-detect the encoding?

What is Shift-JIS encoding?

Shift Japanese Industrial Standards. It is backwards-compatible with ASCII.

What is unicode encoding?

It is a “character set” – a system for representing the characters in all of the world’s writing systems. It is not an encoding system itself, but rather, encoding systems such as UTF-8 and UTF-16 can be used to represent unicode.

What is BOM in UTF-8?

BOM is a “byte order mark” – it is a Unicode character U+FEEF that appears at the beginning of a text stream as a magic number that signals that the following stream is 1. unicode, 2. endianness, and 3. which unicode encoding is used. For UTF-8 BOM is 3 chars long and is 0xEF,0xBB,0xBF.

What is UTF-7 encoding?

It is like UTF-8 but 7-bit. It is not popular.

What can the child pages plugin shortcode do?

https://wordpress.org/plugins/child-pages-shortcode/You can use it to output all or one child page of a parent page. It will display the thumbnail and the excerpt and title below it.It uses its own default html template to display the child page title, thumbnail and excerpt only.Shortcode arguments are: child page id, width, thumbnail size, etc.Available filters are: filters to enable users to specify/change the stylesheet as well as change the default html template as well as change the WP query args that are used in this plugin.What can the contact 7 plugin do?You can make custom contact forms. It has a nice contact form builder – you can specify your own html template that it will use (for example you can use whatever html or classes you want).Then you specify where you want the inputs to go using shortcodes. The plugin even includes a shortcode generator that helps you generate the shortcuts to inser tinto your form html template.You can also specify your own templates for emails in the same way – using the shortcodes created above.Waht is wordcamp?A wordpress casual conference held since 2006 around the world. It is held about once a year in Japan in the summer/early fall.https://japan.wordcamp.org/What is wordbench?It is a Japanese wordpress community for small local study groups. Small events are held monthly in each city with around 10 people each.why is widget not showing up in wordpress admin?Your theme needs to have at least one widget area. You need to register at least one widget area in function.php.To use widgets, you need three things:1. Register a widget in your theme’s functons.php (register_sidebar($widget_args);2. Put php in your template where you want to prin the widget ()3. Specify which widget content to put in that widget throug admin panel -> appearance -> widgets (drag and drop)What can the all-in-one sub navi menu plugin do?You can customize what kinds of navigation menus to show in different wordpress page templates.(for example, you can show different subnavi pages for posts pages, page pages, and home page.On the posts page, you can display menu for categories, on page pages, you can display menu for subpages, and on home page, you can show navi menu for recent posts, etc.).You need to enable a widget somewhere in your theme (ex: sidebar) to use this.I noticed that the carriage return in my html page that comes after a php close tag is not printed. How do I fix it?If there is a carriage return after a php closing tag, apache (? or someone else?) “eats up” one of the carriage returns, after the php tag (but not before). For example, these two html pieces will print the same: <?php echo "mytitle"; ?> <?php echo "mytitle"; ?>They both print this:mytitleIf you want the carriage return printed, you just need to type a double carriage return.What is UTF-8 encoding?It is a way to encode unicode characters using a variable number of bytes (1 to 4 8-bit bytes) per character. It stands for Universal Coded Character Set) Transformation Format – 8-bit. Codes for ASCII characters remain unchanged.For any character equal to or below 127 (hex 0x7F), the UTF-8 representation is one byte. The first 7 bits of the byte represent the ASCII character.For higher characters, the representation of the char is split across multiple bytes. The first byte has a leading number of ones corresponding to the number of bytes and a zero, and the subsequent bytes all start with 10. The remaining free bits in each byte are used to rpreent the character.An advantage of UTF-8 is that:A byte that represents a valid char in ASCII encoding also represents the equivalent char in UTF-8 encodingA byte that represents a valid char in the ASCII range in UTF-8 encoding also represents the equivalent char in UTF-8 encodingA byte that represents a continuation byte in a multi-byte char in UTF-8 encoding always represents an “invalid” char in ASCII encoding (never mistakenly will be interpreted as a differnet char in ASCII encoding).

How can I use tortoise git to push to github?

One process I found works:Login to github and create a new repository. Copy the https link for the repository (ends in .git).On your local computer, right-click on your folder and create a new repository, then do commit to master. Then do push, and push to the url you copied.Github requests your login name (email) and password.First you need to make a key pair (use PuTTyGen.exe.) Copy/paste the public part into the box in github settings.

Why is wp_insert_term not working? (The argument array is not inserted into the database with the taxonomy term)

If the term already exists, the function does not proceed executing (returns an error). Try adding the argument array separately by calling the function wp_update_term. Note that the first argument for wp_update_term is the term_id, not the tern name.

Can I return multiple values from a function in php?

No. But you can return an array and get multiple values stored in the array.There is even nice notation for it:function getXYZ(){ return array(4,5,6);}list($x,$y,$z) = getXYZ();

Can I change upload_max_filesize from within a php script?

No, but you can change it within the .htaccess file. This is a good way if you’re using shared hosting.Add this line:php_value upload_max_filesize 8M

why is type blank in $_FILES when i upload my pdf?

Probably the size of the file was too big.In php.ini:post_max_size (default 8 mb)upload_max_filesize (default 2mb)max_input_timememory_limitAfter you change the php.ini file, you need to restart php (can do this through the xampp control panel)You can putto print out the php setings and check that your changes have been reflected.Another thing to check is folder permissions.

How do you display the call stack trace for php warnings?

Put this code at start of script:set_error_handler(function($severity, $message, $file, $line) { if (error_reporting() & $severity) { throw new ErrorException($message, 0, $severity, $file, $line); }});

How do you get download link to an attachmenet file in wordpress?

Use wp_get_attachment_url($attachment_id).To get the list of attachment_ids for a particular post,$args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘application/pdf’, ‘post_parent’ => $post_ID, );$attachments = get_posts($args);$attachment_id = $attachments[0];wp_get_attachment_url($attachment_id)

How to set value of file input in html?

You cannot. (For security reasons).What you should do is:show the current value of this field by just printing the filename or URL, a clickable link to download it, or if it’s an image: just show it, possibly as thumbnail.

how do you create file uploader in admin panel in wordpress?

(if you treat the upload box as a normal metafield, then the name of the file gets saved in posts_meta, but the file does not get put in the wp-content/uploads folder, and a post with type “attachment” is not created either, which is not what we want).Good overview here:https://wordpress.stackexchange.com/questions/4307/how-can-i-add-an-image-upload-field-directly-to-a-custom-write-panel/4413#4413Basically, you need two things:1. The file needs to be uploaded to wp-content/uploads (this is done by wp_handle_upload).2. The file needs to show up in the wp_posts table with a post_type of “attachment”, and with a parent_post_id of the specified post (if this is what you want). (this is done by wp_insert_attachment).Then the file will show up in the media library.

How do you increase PHP memory limit?

There are several things to try:1. Create php.ini file in wp directory and add this:memory_limit = 64M2. Create .user.ini file in public html directory and add the same line:(only works if php is running in cgi mode)3. Edit .htaccess and add this line:php_value memory_limit 64M(only works if php running as an apache module)

What is the cause of the 500 internal server error when requesting wordpress site?

1. corrupted .htaccess filedelete .htaccess.(wordpress will automatically regenerate one when you save the permalink settings).2. PHP memory limit too smallTry adding this line wo wp-config.php: define(‘WP_MEMORY_LIMIT’, ’64M’);

How can I host multiple wordpress sites on AWS EC2? (not multisite!)I cannot find any good tutorials about this.The conf file is here: /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf /opt/bitnami/apps/wordpress/htdocs/wp-config.php1a. Move existing site to a sub-directory.1b. Confirm the existing site is accessible through the IP/subdirectory.2a. Repoint the DNS.2b. Confirm the existing site is accessible through the domain name.3a. Upload new site to a sub-directory.3b. Confirm the new site is accessible through the IP/subdirectory.4a. Point the DNS for the new site.4b. Confirm the new site is accessible through the domain name.

What is the difference between a UI designer and UI developer?

This also seems not very well defined, but it seems that the difference is that UI developers can do everything UI designers do, plus they have technical skills to implement the design in HTML/CSS/JS/etc.

What is the difference between UI and GUI?

It seems to be just basically whether it’s graphical or not.

What is ui/ux?

These terms seem to be very recent terms for designers in the tech industry, and are also not very well defined, and there is not a lot of agreement about what they really mean. But from what I gather, UX refers to designing the “flow” of how people interact with a product, and UX designers spend their time doing things like observing users or conducting user surveys. They work on storyboards, sitemaps, and wireframes. It seems to be a non-technical role, and also non-graphic design. On the other hand, ui refers to designing the “layout” of individual pages, to make sure it accomplishes what the UX designer intends it to. This also seems to be a non-technical role, but a little more related to graphic design. The differences between UX and UI are not so large.

Is there a node.js alternate for wordpress?

WordPress is being converted to nodejs.

How is WEBGL different from the HTML5 Canvas?

What is webgl?

From Khronos webpage: “WebGL is a cross-platform, royalty-free web standard for a low-level 3D graphics API based on OpenGL ES, exposed to ECMAScript via the HTML5 Canvas element.”I think that this means WebGL is included as a standard on all major browsers for making 3D graphics through the HTML5 Canvas and thatyou can manipulate webgl things with javascript.Another website: s an image library that allows you to create real-time rendered, interactive 3D graphicsRead more at https://www.campaignlive.co.uk/article/webgl-why-using-it/1207130#xlH6Hmms6qVKzWbT.99.

How can i change the order of columns in wordpress admin manage posts?

In the function attached to the filter manage_posts_columns, just modify the order of the array of the columns before returning it. Use the php function array_splice.https://wordpress.stackexchange.com/questions/101728/change-the-order-of-columns-for-a-custom-post-type-on-the-admin-list-pageWhy is wordpress returning 404 instead of using my template for my custom post type archive?Try re-flushing permalinks: admin panel -> settings ->permalink -> save (without changing anything)

How do you add a taxonomy to a query?

Add the ‘tax_query’ parameter to the query argument array.The value for this array key is actually supposed to be an array of arrays, so be careful.

How do you register a taxonomy term programatially?

wp_insert_term function.

Where should I hook register_taxonomy?

The init hook.

Why is the custom taxonomy metabox appearing in the manage posts columns admin panel on only some custom post types but not others?

Same answer as above.

How can i make a custom taxonomy appear in an admin menu?

Adding show_in_menu => ‘my custom menu’ does not work for taxonomies (although it does for custom post types.For taxonomies, you need to

Why is the custom taxonomy metabox appearing on only some custom post types but not others?

When you register the same custom taxonomy to multiple custom post types, you need to pass the multiple custom post types in an array, instead of calling register_Taxonomy multiple times for diferent custom post types!!!Do this:register_taxonomy(‘taxonomyslug’, array(‘customposttypeslug1’, ‘customposttypeslug2’), $args)Not this:register_taxonomy(‘taxonomyslug’, ‘customposttypeslug1’, $args);register_taxonomy(‘taxonomyslug’, ‘customposttypeslug2’, $args);

Why is the custom taxonomy metabox not appearing?

Need to delete ‘meta_box_cb’ => false!!

How do you add a taxonomy metabox to a custom post type?

Just pass the correct argument when you call register_taxonomy.register_taxonomy(taxonomyslug, customposttypeslug)

How to add custom taxonomy to a post?

First you need to register a taxonomy through the function:register_taxonomyTaxonomies are registered for posts or a particular custom post type.For posts, wordpress automatically adds a taxonomy metabox, but for custom, you need to add it yourself.

What is the difference between save_post and post_updated hooks?

save_post hook is triggered whenever you click the “add new” button (before you even fill anything in) as well as after you click the publish button, and also when you update it.post_updated is only triggered whenever you click publish button or update it, also when you delete it, or also triggered automatically when wordpress adds the slug automatically after you input a title.

How do you add a custo column in the manage posts section of the admin panel?

https://code.tutsplus.com/articles/add-a-custom-column-in-posts-and-custom-post-types-admin-screen–wp-24934Register a new columns’s identifier and display string in a callback for this filter: manage_posts_columnsThen register what should be printed out for the values for each post in that column in a callback for this action: manage_posts_custom_column

how to add featured posts to custom post type?

This feature is builtin for regular posts, but you have to add it manually for a custom post type.You can add a post_meta, and you also need to manually add a metabox and save the data that was entered into the metabox, and modify your wordpress query by adding a parameter to the querry variables array or modifying it via a filter.

can i select an input by name in jquery?

Yes. Use this:$(“input[name=’MyName’]”)

how can i make an anchor clickable without making page move when i click it?

When you attach the click event handler, prevent the default action like this:$(‘a.someclass’).click(function(e){ // Cancel the default action e.preventDefault();});Or make href=”#/” instead of “#”.Or just use a span. To make it “clickable”, you need to put css styling.But better yet, use buttons instead of “a” for clicking.

Why isn’t meta_input working in wp_insert_post?

I think it only works with post_type=post. Otherwise you have to manually add the metadata through update_post_meta.

why does the $_POST variable created by JSON.stringify() have escaped quotes when viewed in PHP after sending through ajax? Since it has escaped quotes, json_decode does not work.

I don’t know why. But the problem can be avoided by calling:json_decode(stripslashes($_POST[“myvariablename”]), true);

How do you decode a JSON.stringify() in php?

Use json_decode($thestring, true).Don’t forget to use “true” for the second option if you want to decode associative arrays!

how to programatically create a post in wordpress?

Use this function: wp_insert_post( array $postarr, bool $wp_error = false )See here for what parameters are accepted in postarr:https://developer.wordpress.org/reference/functions/wp_insert_post/

How can I use PHP to parse a boolean sent through ajax?

It seems that PHP receives it as a string that says “true” or “false”. You have to parse it manually.Or else do JSON.stringify() on the data before you send the data in the ajax from javascript , and decode in php.

can i send array through ajax?

Yes. Serialize it first through JSON.stringify() or jQuery.serialize().

How do you create a shortcode?

How to add tabbed box in wordpress admin panel?

There is a wordpress “settings API”:Also wordpress provides css classes already for tabbed navigations:

https://code.tutsplus.com/tutorials/the-wordpress-settings-api-part-5-tabbed-navigation-for-settings–wp-24971

What is the difference between add_post_meta and update_post_meta?

If you specify the argument $unique = false, add_post_meta will add a duplicate key. If you specify the argument $unique = true, add_post_meta will not update the value if tge key already exists.update_post_meta will update the value if the key already exists, and will add a new entry if the key does not exist yet

What causes the php error Uninitialized string offset?

This error occurs if you use array-style indexing on a variable that is actually a string.

what is the second argument in __() in wordpress?

It is the “textdomain” – if you do not specify it, wordpress will look for the translation in the default wordpress textdomain, which probably doesn’t contain the translations of the strings in your custom theme.

What is the difference between esc_html__() and __()?

There are actually four functions:__() for simple text that doesn’t contain markupesc_html__() for text that contains html markup__e() echoes the text (rather than just return it)esc_html__e() echoes the text (rather than just return it)It is necessary to use esc_html__() for user-input text to prevent attacks.

What is esc_html__()?

It means “Retrieve the translation of $text and escapes it for safe use in HTML output.”

What is GNU gettext localization framework?

Why aren’t the translations showing up?

There are two options for Japanese – Japanese, and Japanese (Japan). Try preparing both sets of files.Japanese was the one that worked for me.

How to add translation to wordpress theme?

Actually this involves two main phases:Making your theme translation-ready (it is assumed that theme developers do this – they provide the .pot file with list of terms).Translating it (it is assumed that theme users do this – they take the .pot file and translate it into their own language).Phase 1: Making theme translation-ready0. Create a languages folder inside your theme – this is where to put the pot, po, and mo files.1. Make any strings in your theme you want translated appear as __(‘mystring’, ‘my-textdomain-name’) instead of just ‘mystring’.2. Add these lines in functions.php:add_action(‘after_setup_theme’, ‘my_theme_setup’);function my_theme_setup(){ load_theme_textdomain(‘my-textdomain-name’, get_template_directory() . ‘/languages’);}3. Create a .POT file (download poedit, create new file, go to catalog->properties and fill in the information, then clikc ‘update’. It will scan your theme folder and pick out everyting with __().)Phase 2: Translating it1. Translate the .pot file in poedit. Save it in the theme’s languages folder.2. Add this line to wordpress config file:define (‘WPLANG’, ‘zh_CN’); (Actually this seems to not be necessary).Details here:https://premium.wpmudev.org/blog/how-to-localize-a-wordpress-theme-and-make-it-translation-ready/

What does currentcolor mean in css?

It is a variable that lets you use the color of the current element for other properties (such as background or border color) that accept a color. It is not supported by all browsers.

How can I make a triangle in css?

You can use the border. Make a box with height that is twice the height of the desired triangle and width equal to the width of the triangle (with border-box sizing). Display only the bottom border and make everything else, including contents, transparent. It is a bit of a hack. See here:https://css-tricks.com/snippets/css/css-triangle/

Why does the div I added using the after selector get displayed as text rather than a div?

It is not allowed to add html using the after selector, according to css-tricks.com.

can i use the after selector in css to add a div?

No. It is not allowed to add html using the after selector, according to css-tricks.com. Any text added through the ::after selector gets dislayed as text rather than as an html element, so you would literally see ‘

on your webpage if you tried to do this.Furthermore, if you use the after selector, the content that gets added gets appended to the end of the contents of the element that was selected, not after the element itself. So the div would be nested inside the outer element.

Why is adding a query variable through query_vars filter not working?

I read that in addition to using this filter, you also need a custom rewrite rule. Don’t forget to flush the queue.

how to parse sql clause in wordpress?

It seems there are no particular ways other than regex on the string…

What are wordpress’s default rewrite rules?

What does add_rewrite_rule do in wordpress?

https://codex.wordpress.org/Rewrite_API/add_rewrite_ruleUse it like this:add_rewrite_rule($regex, $redirect, $after); regex is the regex to match against the requested url,redirect is the url to actually fetch,after is a boolean to specify whether you want your rewrite rule to be processed before or after wordpress’s default rewrite rules.You can use this to define new formats for URLs and tell wordpress how to interpret them. The URL will get parsed into query variables depending on how you write the rewrite rule, and these query variables are accessible from wordpress templates/plugins through the wp_query variable.For example, if you add this rewrite rule: add_rewrite_rule(‘^nutrition/([^/]*)/([^/]*)/?’,’index.php?page_id=12&food=$matches[1]&variety=$matches[2]’,’top’);Wordpress would know how to parse this url: http://example.com/nutrition/milkshakes/strawberry/Then the variables would be accessible like this: $wp_query->query_vars[‘food’]; $wp_query->query_vars[‘variety’];Another example:For example, if you add this rewrite rule: add_rewrite_tag(‘%food%’, ‘([^&]+)’); add_rewrite_tag(‘%variety%’, ‘([^&]+)’);Wordpress would know how to parse this url: http://example.com/index.php?page_id=12&food=milkshake&variety=strawberryThen the variables would be accessible like this: $wp_query->query_vars[‘food’]; $wp_query->query_vars[‘variety’];

What is the difference with these functions: the_post_navigation() vs previous_post_link()?

A nice explanation is here:https://digwp.com/2016/10/wordpress-post-navigation-redux/previous_post_link() is older way to do it, and the_post_navigation() is newer.

how to load css from a plugin?

wp_enqueue_style to load a separate css sheet,or print to the header to add a stylesheet link in the header or in-page stylesheet.add_action( ‘wp_head’, ‘callback func’ );

why is_main_query true on sidebar?

Not sure. It’s not supposed to be, but it is in 2017. One workaround is to expand the conditional to this:is_main_query() && in_the_loop()

what is the difference between singular and single in wordpress?

is_singular() is equivalent to is_single() || is_page() || is_attachment().is_single is for targetting single post pages.is_singular expands that to pages with a content-{name}.php template.Read here for the wordpress documentation:https://codex.wordpress.org/Conditional_Tags

how do i stop line breaks from being inserted in php output buffer?

Not sure… The only workaround fund is to delete line breaks, but this makes the code very ugly…

How can I make wordpress differentiate between a request for a single post of a custom post type from the custom post type archives and from the home page? (Because I want the next/prev navigation links to work differently depending on if the viewer is only looking at posts from the custom post type, or ALL posts).

First of all, the next/prev navigation links are made by a separate DB query, which uses the post_type of the current post object ($post->post_type). $post->post_type is hardcoded in in the wordpress core. So to work around, you can temporarily overwrite $post->post_type before the function for next/prev nav link generation gets called in the template (maybe in the loop_end hook?). That is good for the home page, but then how would you know whether to do that or not for single posts linked from the archive page? I think you would also need some other kind of “classification” (taxonomy?) that is encoded in the request URL or query variables somehow so that you would know whether you need to overwrite post_type or not. Like make one url for requesting single post page from the home page, and another url for requesting single post page from the archive page. But even if I request the page using different url formats (for example mydomain/2017/12/13/posttitle, mydomain/categoryname/posttitle, or just mydomain/posttitle), the wp_query variables all seem to be the same. And my browser url always gets set back to mydomain/2017/12/13/posttitle.See here:https://wordpress.stackexchange.com/questions/222677/how-does-the-the-post-navigation-work-for-cptsYou can use the “get next post where” filter – this intercepts the “where” clause of an sql query used to make the next/prev post links and you can overwrite it.

Why are navigation links not showing up on the custom post type single post page?

This solved the problem partially: Remove “True” in the next code:“True” tells wordpress to only move between posts of the same type.But on the home page, I want ot to move between all post types, and on the gallery page, i want it to move between only envira custom post type.

Why is previous_post_link not working?

First of all, it needs to be on a permalink, singular page.Also, see the next question.

How do you instantiate a wp post object?

Create a php stdClass like:$post = new stdClass();then add the necessary properties, then convert it to the wp post class:$wp_post = new WP_Post( $post );See here:https://barn2.co.uk/create-fake-wordpress-post-fly/

How do you make wordpress redirect to a different template?

Use template_include filterm not template_redirrect.

how do i buffer html output in php?

Use ob_start, ob_get_contents, and ob_end_clean.http://php.net/manual/en/function.ob-start.php

in wordpress, when are shortcodes parsed?

Not sure but you can force shortcodes to be parsed using do_shortcode(“myshortcodestring”);I thin they are parsed in the the_contents() call.

How do I format a date in wordpress from a custom post field?

echo date(get_option(‘date_format’), strtotime($mydate));

How can I display an archive of custom post types that are defined in a plugin using normal archive/page templates from the theme?

My idea is that when I get the query for the custom post type archive, I can redirect wordpress to use either the normal archive.php or page.php, but I can rewrite the content that is output from the wp query – I can build up the html tree from the post parts in the query and output it as the content of a single page, which then gets displayed normally inside the archive.php or page.php template.Or you can hook into the the_post hook or

How do i use a overwrite what template wordpress uses to display a query?

Not sure.

Is there a wordpress hook before running the wordpress loop?

Yes, look at the following hooks:loop_startthe_post get_template_part_content loop_endI think they could be used to display custom post types from a plugin in a custom why while still using the headrs/foters from the theme’s template.

can i modify properties of a registered custom post type?

Yes, there is a wordpress hook for it:https://wordpress.stackexchange.com/questions/65075/use-register-post-type-to-modify-an-existing-post-type

Why do I get a 404 error when trying to view my custom post type archive?

Not sure. Try checking publicly_queryable and has_archive and show_in_menu and public when it was registered through the register_post_type hook.

Next Page »