In file products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/package.module.nextgen_basic_imagebrowser.php, on line 74 you have a check to find the current image.
The relevant code is:
if ($picture->image_slug == $pid)
The thing is that $pid is a clean string, and $picture->image_slug is URL-encoded.
For example, $pid is מיראז-1 while $picture->image_slug is %d7%9e%d7%99%d7%a8%d7%90%d7%96-1.
If you upload an image with a filename in Hebrew/Arabic - the result is that you always only see the first image in the imagebrowser.
The plugin can't show any other image, besides the first. Both with or without AJAX.
I went through all of the filters and actions possible with the plugin,
but it only affects the logic after this part that I was referring to.
Any thoughts on this?
Related
I want to display the preview thumbnail of the multifile upload field. I had followed this thread but I found that {fileName} had some random string. It’s between {input id} and {file.target_name}.
Ex: 4a017277_input_5_zfKuGrwCd91CyiHy_o_1esroacel59uais19ev1dqa405q.png.
What is {zfKuGrwCd91CyiHy}?
tmp image's name
I had found a solution for this. It's not a beautiful way but it worked like a champ.
The random string above was rendered by a function random_str(). My solution is to remove or customizing the function.
File located at path: ../wp-content/plugins/gravityforms/includes/upload.php
enter image description here
I'm just starting to use C5 as a CMS, and I'm having issues with sorting out the page addresses.
If I add a page to the site, it will be visible at:
www.example.com/index.php/page
However, I find the url extremely messy, and would ideally like it to be
www.example.com/page
I'm not familiar with C5, would anyone be able to give me any pointers to change this?
Okay, After reading documentation, this can be done by enabling "Pretty URLs"
This can be achieved by:
Dashboard -> System and Settings -> SEO and Statistics -> Pretty URLs
You then get a dialogue which has a tickbox, select it and click SAVE.
C5 should be able to rewrite the .htaccess file.
If it is unable to do so, it will give you an error, and you can copy and paste the text generated in the next screen, to add to the file manually.
I see that you enabled pretty URLs on the dashboard:
http://www.yoursite.com/index.php/dashboard/system/seo/urls/
Nice work, one last step—add the following to site.php in your root/config/:
define('URL_REWRITING_ALL', true);
That'll make every URL, such as a link to a dashboard page, pretty:
http://www.yoursite.com/dashboard/system/seo/urls/
Whilst this will add friendly URL's it will not add create canonical urls, if the same page appears with various urls they will create duplicated content links.
To add a canonical link you can add the following to your header.
//Set the base url for the home page
$canonical = BASE_URL.DIR_REL;
if ($c->getCollectionId() != 1){
//Get the current URL for the page
$canonical=$nh->getCollectionURL($c);
}
//Output a canonical meta tag
printf('<link rel="canonical" href="%s" />', $canonical);echo "\n";
you can go to dashboard > Bulk SEO Updater > and change the URL here
I am using the WPAlchemy class to create a meta box for my custom post type which includes image upload fields. The setup works and I can add image and save the images url for each post. I setup everything as shown here: http://www.farinspace.com/wpalchemy-metabox/#installsetup
How do I now display the saved image meta url on my page? Ideally I would like to be able to display as an image on the page by adding the image's url to image src so it displays the image not the link. However I would be happy to just display the url on the page to start to make sure it's present. But I am really stuck knowing how to echo or print the info to the page. I have tried following some of their examples but nothing seems to be working and I sometimes get php errors saying:
Fatal error: Call to a member function the_name() on a non-object in C:\
Any help appreciated. I thought it would be easier than it is, like the_meta() or something similar but it's not clear what to add to get the info showing up on page.
Cheers
Best things to do is use:
global $custom_mb;
$meta = $custom_mb->the_meta([ID_IS_OPTIONAL]);
$meta will be an array of all your stored values for the given post, loop through it as you normally would loop an array
I need to add an image to each page in WordPress.
I don't wish to insert it using the WYSIWYG editor, I just need the url as a custom field, which I later use in the template.
I tried using the CFI plugin (Custom Field Images), and I hacked my way into getting it to work with the rest of my plugins, but then I moved the site to the production server and CFI just didn't work for some reason.
I can't seem to find any other plugin that just lets you pick an image from the library and add it as a custom field.
I've downgraded to the point where I'm willing to manually enter all the URLs into each and every page. but before I do, I thought I'd check here.
Can anyone tell me what's the easiest, best way to add images as custom fields in WordPress (2.7.1 if it matters)?
In our WordPress template, each post generally only has one image 'attached', which is displayed outside the posts' (textual) content.
I simply upload the file using the edit posts' media uploader, never insert it into the post like JoshJordan above, then retrieve the image using a bit of code in the right place in my template file.
This would also work if you're using more than one image in your post, eg. in your post content. As long as you keep the image used as the 'main' post image as the first image (remember you can re-order images in your posts' image library by dragging them up and down), you're easily able to call it anywhere in your template file by using something like this:
<?php
$img_size = 'thumbnail'; // use thumbnail, medium, large, original
$img_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_parent= $post->ID and (post_mime_type = 'image/jpeg' OR post_mime_type = 'image/gif') and post_type = 'attachment'");
$img_array = wp_get_attachment_image_src($img_id,$img_size,false);
echo '<img src="'.$img_array[0].'"' title="'.get_the_title().'" />';
?>
No need for copying and pasting image urls.
The template I have uses a manually-entered custom field for the splash image of each post. When I'm done writing my article, I upload an image, copy its URL from the upload tool, never insert it into my post, and then paste that URL into the "Image" custom field. Simple as pie and takes only seconds. Insignificant compared to the amount of time it takes me to write an article.
You can use the custom key value fields on posts as well. let's say you always give your images the key 'thumb'. you can then use this code to output them in your post as a thumbnail:
<?php
$values = get_post_custom_values("thumb");
echo “<img src=\”$values[0]\” class=\”thumb\”></a>”; ?>
Consider using Flutter it's a bit tricky to figure out at first, and has many really useful featured, including EIP (edit in place), and image handling.
After installing the plugin create a new "Write Panel", you'll figure it out from there. The plugin provides you with a rather intuitive GUI, which includes an image uploader. The template tags are very easy to use, I believe it's something like
<?php echo get_image('name_of_field'); ?>
I just had to build a site for a client that needed the same feature, I ended up using Flutter.
I've been looking for this all over, and simply cannot find it.
I have a blog that has no titles in its blog posts, but I'd like, for various usability reasons, to have the permalinks use the first few words from entries that do not have titles as the permalink slug.
ie, if the post on sample.com/blog is
Title: (no title)
Content: Ten Easy Ways to Lose Weight
The permalink could be sample.com/blog/ten-easy-ways-to-lose-weight.
Are there any plugins that do this? For the life of me, I cannot find one. (xposted to WP support, but no one is responding)
You could enter in titles, and then not display them in your view template.
I doubt there's anything like this already built for wordpress. To get your blog to do this, you have to write a plugin that does the following:
Generates the slug while checking
for uniqueness should you ever start
more than one entry with the same words
Processes URL requests to recognize slug permalinks and then updates the query step to locate the correct post in the database. This might involve a new db table of slugs (which would also help with the uniqueness issue)
In short, WP is designed to retrieve almost everything by keys, and to support slugs like this you'd have to create a new key type.
btw: if anything is retrieved by IDs (keys), it is technically not a permalink. so, wordpress probably fails in providing true permalinks.
ps: it's not that difficult to write an handler/dispatcher that would parse URL and takle out the unique permalink and then match it to the DB by the string (not by the key!).
something like:
$url=$_SERVER["REQUEST_URI"];
echo 'URL called: ',$url,'<br />';
$dispatchfile=$dispatcher->Dispatch($url);
if ($dispatchfile)
{
echo 'launching ',$dispatchfile,' inclusion<br />';
require($dispatchfile);
}
else
{
echo 'dispatcher failed to find module, will check physical file<br />';
if (file_exists($url)) echo 'dispatcher found physical file<br />';
else echo 'nada, throw 404!';
}
You can get a permalink redirect plugin from
http://scott.yang.id.au/code/permalink-redirect/
Works fine with WP2.71
It takes the Title and auto-creates a slug from that so you would have to manually enter the slug you wanted for each page if you have a Blank Title.
You should be able to hack Scott's PHP file (it is one page only) to look up the page code and select a portion of it to use as a slug though.
In addition, I solve incorrect page requests using a .htaccess rewrite file to bring up the index page upon an incorrect page request.
Download a copy of my rewrite file here
https://oulixes.com/htaccess_example.zip
Unzip the txt file and rename as .htaccess and upload into your root directory
Hope this helps!
Cheers,
Billy