Tiki Web Group https://www.tikiwebgroup.com Mon, 09 Mar 2020 17:06:48 +0000 en-US hourly 1 https://www.tikiwebgroup.com/wp-content/uploads/2020/04/color-star-3-152-217610-150x150.png Tiki Web Group https://www.tikiwebgroup.com 32 32 73820239 Show the content from one post or page elsewhere on your WordPress site https://www.tikiwebgroup.com/blog/2020/03/09/show-the-content-from-one-post-or-page-elsewhere-on-your-wordpress-site/ https://www.tikiwebgroup.com/blog/2020/03/09/show-the-content-from-one-post-or-page-elsewhere-on-your-wordpress-site/#respond Mon, 09 Mar 2020 17:06:48 +0000 http://www.tikiwebgroup.com/?p=2584 <?php
$post_id = 107;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo $content;
?>

Show the content from one post or page elsewhere on your WordPress site originally appeared on Tiki Web Group on March 9, 2020.

]]>
https://www.tikiwebgroup.com/blog/2020/03/09/show-the-content-from-one-post-or-page-elsewhere-on-your-wordpress-site/feed/ 0 2584
making a random page on your wordpress website https://www.tikiwebgroup.com/blog/2019/09/10/making-a-random-page-on-your-wordpress-website/ https://www.tikiwebgroup.com/blog/2019/09/10/making-a-random-page-on-your-wordpress-website/#respond Wed, 11 Sep 2019 02:29:31 +0000 http://www.tikiwebgroup.com/?p=2577 here’s my own solution to this:

step one: make a file in your template directory and add this as the content:

<?php
/*
Template Name: Random Post Redirector
Use on page to send viewer to random post optionally mod query
*/

// set arguments for WP_Query on published posts to get 1 at random
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 1,
'orderby' => 'rand',
'post__not_in' => get_option("sticky_posts"),
);

// It's time! Go someplace random
$my_random_post = new WP_Query ( $args );

while ( $my_random_post->have_posts () ) {
$my_random_post->the_post ();

// redirect to the random post
wp_redirect ( get_permalink () );
exit;
}
?>

Step two: Create a page and select the custom template you created above.

Optional Step three: If you want your front page to always show a random post, Go to your “reading” settings page at www.example.com/wp-admin/options-reading.php and select the “static page” option to use the page you created above. Word of caution though, having this on your front page may cause some pretty big server spikes if you don’t have caching turned up to 11.

making a random page on your wordpress website originally appeared on Tiki Web Group on September 10, 2019.

]]>
https://www.tikiwebgroup.com/blog/2019/09/10/making-a-random-page-on-your-wordpress-website/feed/ 0 2577
A word of caution and frustration when using media_sideload_image https://www.tikiwebgroup.com/blog/2017/07/18/a-word-of-caution-and-frustration-when-using-media_sideload_image/ https://www.tikiwebgroup.com/blog/2017/07/18/a-word-of-caution-and-frustration-when-using-media_sideload_image/#respond Wed, 19 Jul 2017 03:33:30 +0000 http://www.tikiwebgroup.com/?p=2564 media_sideload_image details.

Currently the support docs for this function read:

Parameters Parameters

$file

(string) (Required) The URL of the image to download.

$post_id

(int) (Required) The post ID the media is to be associated with.

$desc

(string) (Optional) Description of the image.

Default value: null

$return

(string) (Optional) Accepts ‘html’ (image tag html) or ‘src’ (URL), or ‘id’ (attachment ID).

Default value: ‘html’

Unfortunately when they say “Description” they really mean “title” of the attachment, and not the field named “description” that’s on every attachment page. There is no way that I can tell to add a description to your attachments when using media_sideload_image.

A word of caution and frustration when using media_sideload_image originally appeared on Tiki Web Group on July 18, 2017.

]]>
https://www.tikiwebgroup.com/blog/2017/07/18/a-word-of-caution-and-frustration-when-using-media_sideload_image/feed/ 0 2564
Where does WordPress store image resolution in the MySQL database? https://www.tikiwebgroup.com/blog/2017/01/08/where-does-wordpress-store-image-resolution-in-the-mysql-database/ https://www.tikiwebgroup.com/blog/2017/01/08/where-does-wordpress-store-image-resolution-in-the-mysql-database/#respond Sun, 08 Jan 2017 18:39:44 +0000 http://www.tikiwebgroup.com/?p=2560 A full year later and I’ve discovered that the image resolution IS stored in a very poor manner, as custom fields on the attachment. I’m still not clear on exactly how that works and I think I can write a plugin that will convert that crummy method to a custom taxonomy that would allow searching and easy display on sites.

Previously in 2017:


TL;DR: WordPress does not store image resolution in the database.  Nor does it store any information on the difference sizes of the image that it automatically creates.  Looks like the only interaction WP has with images and their resized versions is on initial load, after that it has no record of what’s available for use in posts.

Spent about an hour this morning searching for an answer for this, but there’s no indication that the image size is stored anywhere in the database.  Any time the image is referenced in full from WP, getimagesize is used to get the resolution. The rest of the the image attachment’s meta data is stored haphazardly in either wp_postmeta or wp_posts.  Oddly enough when using getimagesize outside of wp_get_attachment_image_src I seem to get different results (0x0 vs 9393×12500), which may have something to do with image size limits or memory limits in WP.

Here’s where you can find the data that’s stored for each image attachment:

wp_posts:
post_content = description
post_title = image title
post_excerpt = image caption

wp_postmeta:
_wp_attachment_image_alt

If you’ve created a custom taxonomy for your attachments, they’ll be found in the expected taxonomy tables (wp_termmeta, wp_terms, wp_term_relationships, wp_term_taxonomy)

Ref:

php.net/manual/en/function.getimagesize.php

developer.wordpress.org/reference/functions/wp_get_attachment_image_src/

Where does WordPress store image resolution in the MySQL database? originally appeared on Tiki Web Group on January 8, 2017.

]]>
https://www.tikiwebgroup.com/blog/2017/01/08/where-does-wordpress-store-image-resolution-in-the-mysql-database/feed/ 0 2560
Advertisement Companies that are not affiliated with the Tiki Web Group https://www.tikiwebgroup.com/blog/2016/02/10/advertisement-companies-that-are-not-affiliated-with-the-tiki-web-group/ https://www.tikiwebgroup.com/blog/2016/02/10/advertisement-companies-that-are-not-affiliated-with-the-tiki-web-group/#respond Wed, 10 Feb 2016 17:17:22 +0000 http://www.tikiwebgroup.com/?p=2550 For various reasons, these companies are no longer affiliated with the TWG :

Google Surveys
H12 Media
Open AdStream 24/7
Po.st
SeKindo
TrafficBroker
YieldBuild
Zedo / Gunggo

Advertisement Companies that are not affiliated with the Tiki Web Group originally appeared on Tiki Web Group on February 10, 2016.

]]>
https://www.tikiwebgroup.com/blog/2016/02/10/advertisement-companies-that-are-not-affiliated-with-the-tiki-web-group/feed/ 0 2550
How to remove Emoji support from WordPress https://www.tikiwebgroup.com/blog/2015/04/28/how-to-remove-emoji-support-from-wordpress/ https://www.tikiwebgroup.com/blog/2015/04/28/how-to-remove-emoji-support-from-wordpress/#comments Tue, 28 Apr 2015 15:13:33 +0000 http://www.tikiwebgroup.com/?p=2536 The latest version of WordPress has some pretty stupid additions to it, namely the mandatory support of “emoji”, which are one of the greatest diseases on the internet. Why they thought adding more overhead to every WordPress installation just to add this little wanted feature was a good idea is beyond me, but if you’d like to remove it from your sites, add this bit of code either to your theme’s function.php file or your own custom fuction plugin that you’ve previously created:

remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 );
remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ );

thanks to antsanchez.com for the heads up.

How to remove Emoji support from WordPress originally appeared on Tiki Web Group on April 28, 2015.

]]>
https://www.tikiwebgroup.com/blog/2015/04/28/how-to-remove-emoji-support-from-wordpress/feed/ 2 2536
How to remove the Link Manager for your Blogroll from your WordPress dashboard https://www.tikiwebgroup.com/blog/2014/11/05/how-to-remove-the-link-manager-for-your-blogroll-from-your-wordpress-dashboard/ https://www.tikiwebgroup.com/blog/2014/11/05/how-to-remove-the-link-manager-for-your-blogroll-from-your-wordpress-dashboard/#respond Wed, 05 Nov 2014 18:13:42 +0000 http://www.tikiwebgroup.com/?p=2528
  • go to example.com/wp-admin/options.php
  • find “link_manager_enabled”
  • Change the “1” to “0”
  • Hit enter
  • Please note this just hides the “Links” menu item on your dashboard, to truly remove the links, navigate to your database and remove the “wp_links” table.

    How to remove the Link Manager for your Blogroll from your WordPress dashboard originally appeared on Tiki Web Group on November 5, 2014.

    ]]>
    https://www.tikiwebgroup.com/blog/2014/11/05/how-to-remove-the-link-manager-for-your-blogroll-from-your-wordpress-dashboard/feed/ 0 2528
    echo the referer with PHP https://www.tikiwebgroup.com/blog/2014/07/18/echo-the-referer-with-php/ https://www.tikiwebgroup.com/blog/2014/07/18/echo-the-referer-with-php/#respond Fri, 18 Jul 2014 13:57:16 +0000 http://www.tikiwebgroup.com/?p=2519 ]]> <?php
    echo $_SERVER[‘HTTP_REFERER’];
    ?>

    echo the referer with PHP originally appeared on Tiki Web Group on July 18, 2014.

    ]]>
    https://www.tikiwebgroup.com/blog/2014/07/18/echo-the-referer-with-php/feed/ 0 2519
    show how many attachments a wordpress post has https://www.tikiwebgroup.com/blog/2011/01/29/show-how-many-attachments-a-wordpress-post-has/ https://www.tikiwebgroup.com/blog/2011/01/29/show-how-many-attachments-a-wordpress-post-has/#respond Sat, 29 Jan 2011 16:41:11 +0000 http://www.tikiwebgroup.com/?p=2457

    Files: <?php echo $wpdb->get_var( “SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = ‘$post->ID’ AND post_type = ‘attachment'” ); ?> |

    show how many attachments a wordpress post has originally appeared on Tiki Web Group on January 29, 2011.

    ]]>
    https://www.tikiwebgroup.com/blog/2011/01/29/show-how-many-attachments-a-wordpress-post-has/feed/ 0 2457
    How to show the user level in wordpress in the comments https://www.tikiwebgroup.com/blog/2009/09/30/how-to-show-the-user-level-in-wordpress-in-the-comments/ https://www.tikiwebgroup.com/blog/2009/09/30/how-to-show-the-user-level-in-wordpress-in-the-comments/#respond Wed, 30 Sep 2009 18:03:06 +0000 http://www.tikiwebgroup.com/2009/09/how-to-show-the-user-level-in-wordpress-in-the-comments/ This is how you can show the comment user’s level:

    $user = get_userdata($comment->user_id); echo $user->user_level;

    How to show the user level in wordpress in the comments originally appeared on Tiki Web Group on September 30, 2009.

    ]]>
    https://www.tikiwebgroup.com/blog/2009/09/30/how-to-show-the-user-level-in-wordpress-in-the-comments/feed/ 0 2401