Nirav Sheth
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Content Within PostIf you want to autoreplace words and make things even more dynamic, you can do it this way:
<?php // Paste this code in functions.php // coke pepse sprite are shown like slugs here, you can also just use IDs (that would be easier) $category_extra_info = array( 'coke' => array( 'link' => 'https://domain.com', 'image' => 'https://domain.com/logo.png' ), 'pepsi' => array( 'link' => 'https://domain2.com', 'image' => 'https://domain2.com/logo.png' ), 'sprite' => array( 'link' => 'https://domain3.com', 'image' => 'https://domain3.com/logo.png' ), ); function category_extra_info_parsing( $text ){ // make it accessible global $category_extra_info; // loop and build the $replace array foreach ( $category_extra_info as $cat => $info ) { $replace[ $cat ] = '<a href="' . $category_extra_info['coke']['link'] . '">' . $cat . '</a>'; } // replace words now $text = str_replace(array_keys($replace), $replace, $text); //return modified content return $text; } add_filter('the_content', 'category_extra_info_parsing'); // add_filter('the_excerpt', 'category_extra_info_parsing'); // Uncomment this line for parsing the category words // And then use it like this in your template // echo '<a href="' . $category_extra_info['coke']['link'] . '"><img src="' . $category_extra_info['coke']['image'] . '" alt="logo" /></a>';
Forum: Fixing WordPress
In reply to: Custom Content Within PostFrom what I see, the easiest way to do this would be to build an array like this:
<pre> <?php // Paste this code in functions.php // coke pepse sprite are shown like slugs here, you can also just use IDs (that would be easier) $category_extra_info = array( 'coke' => array( 'link' => 'https://domain.com', 'image' => 'https://domain.com/logo.png' ), 'pepsi' => array( 'link' => 'https://domain2.com', 'image' => 'https://domain2.com/logo.png' ), 'sprite' => array( 'link' => 'https://domain3.com', 'image' => 'https://domain3.com/logo.png' ), ); // And then use it like this anywhere in template echo '<a href="' . $category_extra_info['coke']['link'] . '" rel="nofollow"><img src="' . $category_extra_info['coke']['image'] . '" alt="logo" /></a>'; ?> </pre>
Forum: Fixing WordPress
In reply to: Custom Content Within PostWhen you say a new content type, do you mean you’ll have a taxonomy or category that stores this information somewhere?
Forum: Fixing WordPress
In reply to: Featured Content GalleriesWhen you say “tags”, do you mean shortcode?
Forum: Fixing WordPress
In reply to: php else if code problemBut you can use PHP if you you install this plugin: https://www.ads-software.com/extend/plugins/php-code-widget/
Forum: Fixing WordPress
In reply to: Unique Custome Menus in SidebarAre you comfortable digging into the code or do you only want a plugin for this feature?
Forum: Fixing WordPress
In reply to: Automatic logout after second editHi Patty,
I can try to help you out. Can you either shoot me a login to the site or guide me on how I can reproduce it through some other manner?
Forum: Plugins
In reply to: [Audio Player] [Plugin: Audio Player] Logged In UserI’ve found that any .mp3 file uploaded anywhere on this domain becomes restricted. Is there something this plugin does to any core WP files or WP database that would cause all .mp3 files anywhere on the server to become restricted?
If so, how do I undo this?