Ask your WordPress questions! Pay money and get answers fast! (more info)

I need some changes to smart archive reloaded WordPress

  • SOLVED

With Bhavesh Vaghela help, I made some change to smart archive reloaded (SAR). You can get the [[LINK href="wpquestions.com/question/showChrono/id/9223"]]new working plugin here[[/LINK]]

What I need now is:

1-allow title link directly to pdf custom field
I have a custom field to upload pdf file. This file must be download directly when you click on post title.
I can do it with normal theme template file but how to include it in SAR fancy template?

2-set months names default to italian and change them according to browser language.

3-make a new template that filter only by year
I have "fancy" template that is working fine. For another page, i want "fancy2" template. see image bellow.

Answers (1)

2014-02-12

Bob answers:

I will try to check this to night.

can you use plugin to display pdf directly in post?
you can use different plugins to show pdf files like
http://wordpress.org/extend/plugins/dirtysuds-embed-pdf/


Bob comments:

can you please give me custom field name that you are setting for custom field?

new code for showing yearly archive without months is completed. Testing it.


Bob comments:

can you please provide me how to write months in different languages?


zounars comments:

Here is the code i use for the custom field.

array(
'name' => 'Allegato',
'desc' => 'Upload il file da allegare.',
'id' => $prefix . 'dir_age_allegato',
'type' => 'file',
),


zounars comments:

English--
January
February
March
April
May
June
July
August
September
October
November
December


Italiano--Italian
Gennaio
Febbraio
Marzo
Aprile
Maggio
Giugno
Luglio
Agosto
Settembre
Ottobre
Novembre
Dicembre


Español--Spanish
Enero
Febrero
Marzo
Abril
Mayo
Junio
Julio
Agosto
Septiembre
Octubre
Noviembre
Diciembre


Français--French
janvier
février
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
décembre


Bob comments:

I will start further development once you reply :)


zounars comments:

Bhavesh Vaghela, which replies are you talking about? I think I answer you questions. If you miss them,

<strong>Here is the code i use for the custom field.</strong>

array(

'name' => 'Allegato',

'desc' => 'Upload il file da allegare.',

'id' => $prefix . 'dir_age_allegato',

'type' => 'file',

),


<strong>how to write months in different languages</strong>
English--
January
February
March
April
May
June
July
August
September
October
November
December


Italiano--Italian
Gennaio
Febbraio
Marzo
Aprile
Maggio
Giugno
Luglio
Agosto
Settembre
Ottobre
Novembre
Dicembre


Español--Spanish
Enero
Febrero
Marzo
Abril
Mayo
Junio
Julio
Agosto
Septiembre
Octubre
Noviembre
Diciembre


Français--French
janvier
février
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
décembre


Bob comments:

Oh it was my mistake I didn't refresh the page before writing so you gave answer to my question and I reply.

I found little bug in my code written last night.

I will solve it and add this new code. It seems you used metabox plugin for custom field right?


Bob comments:

Please note that code is little complicated and It might take little more time.


zounars comments:

Yes i use [[LINK href="https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress"]]Custom-Metaboxes-and-Fields-for-WordPress[[/LINK]]


Bob comments:

You might set <strong>$prefix</strong> variable for file custom field in metabox I also need that.


zounars comments:

<strong>$prefix = '_scmb_';</strong>


Bob comments:

Thanks. work is in progress.


Bob comments:

Hi,
I have completed coding.

<strong>First of all take backup of old plugin before doing anything.</strong>

Following is format in for not showing months and display posts yearly.
Notice <strong>'show_months' => 'no'</strong> in below code.

$sar_args = array(
'format' => 'fancy',
'main_cat' => 34,
'show_months' => 'no'
);
$query_args = array(
'cat' => 34,'orderby' => 'date', 'order' => 'DESC'
);
smart_archives( $sar_args, $query_args );


If you wish to use shortcode then


[smart_archives main_cat="5" show_months="no"]


Here is link of new modified plugin
[[LINK href="http://wp-lovers.com/wp-content/uploads/2014/02/smart-archives-reloaded-new.zip"]]http://wp-lovers.com/wp-content/uploads/2014/02/smart-archives-reloaded-new.zip[[/LINK]]

I tried to surf access your page with different language option but it seems that it do not work.
http://aipd.essors.net/che-cosa-facciamo/ufficio-stampa/comunicati-stampa/?lang=fr_fr

I wrote month code which depends on <strong>lang</strong> query variable.

I used "_scmb_dir_age_allegato" as meta key for pdf custom field and suppose that it will return me url of pdf file.